Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
37 lines (27 sloc) 828 Bytes
title signature
Getting Zones for country
moment.tz.zonesForCountry(String); // String[] moment.tz.zonesForCountry(String, { offset: true });

To get a list of time zones for some country, use moment.tz.zonesForCountry().

moment.tz.zonesForCountry('US');

By default this method returns zone names sorted alphabetically:

["America/Adak", "America/Anchorage", ... "Pacific/Honolulu"]

To get also offsets, pass { offset: true } as 2nd parameter:

moment.tz.zonesForCountry('CN', { offset: true });

it returns array of objects with name and offset:

[
   { name: "Asia/Shanghai", offset: -480 },
   { name: "Asia/Urumqi", offset: -360 }
]

It's useful if you need to sort time zones by offset.

All country codes can be retrieved using method moment.tz.countries()

You can’t perform that action at this time.