javascript - moment get time in different timezones -


i have 4 different timezones

<select class="pull-left marg-l-5px" id="hourstimezone">  <option>-</option>  <option>est</option>  <option>cst</option>  <option>pdt</option>  <option>mdt</option> </select> 

i added moment timzone file data project, file name is

/moment-timezone-with-data-2010-2020.js 

i'm in ist , typing following command

moment().tz('est'); 

is returning time in ist,if try same other timezones cst,pdt,mdt i'm getting errors

moment timezone has no data ---. 

check following image

enter image description here

what wrong here?

is there way time in these timezones?

or please tell me string est , other timezones in moment data string

there many string if search in this file, like

i want "query 'america/los_angeles' , you'll est time".

thanks in advance

you should never rely on time zone abbreviations selection or input. ambiguous. "cst" alone has 5 different meanings. see the list on wikipedia.

additionally, abbreviation doesn't represent entire time zone. consider cst applies north american central time zone during standard time, while cdt applies during daylight time.

recognize time zones used in moment-timezone must valid within iana time zone database. you can find list here.

i believe looking time zones applicable in united states. assuming don't care historical dates, minimal set need include arizona, hawaii, , alaska. list be:

<select class="pull-left marg-l-5px" id="hourstimezone">  <option>-</option>  <option value="america/new_york">eastern</option>  <option value="america/chicago">central</option>  <option value="america/denver">mountain</option>  <option value="america/phoenix">arizona</option>  <option value="america/los_angeles">pacific</option>  <option value="america/anchorage">alaska</option>  <option value="pacific/honolulu">hawaii</option> </select> 

Comments