Reputation: 55
I'm working on a calendar solution that will be used internationally. In my data I have the timezone abbreviation (CET, EST, JST). Can this abbreviation be passed in to moment-timezone.js to do the time and date conversions from EST, which is what the data provider defaults to?
Upvotes: 0
Views: 469
Reputation: 241525
No. This is an impossible task, because time zone abbreviations are inconsistent and ambiguous. For example, CST could be Central Standard Time in the US, or in Australia. Or it could be China Standard Time or Cuba Standard Time.
In general, use time zone abbreviations for display only. Do not parse them as input.
Upvotes: 2
Reputation: 17574
From the documentation(http://momentjs.com/docs/#/parsing/utc/) I know you can use UTC:
moment.utc();
moment.utc(Number);
moment.utc(Number[]);
moment.utc(String);
moment.utc(String, String);
moment.utc(String, String[]);
moment.utc(String, String, String);
moment.utc(Moment);
moment.utc(Date);
As for CET, EST and JST I am not sure, but you can calculate those based on deviations from the UTC. For example, there is a direct correspondence from CET to UTC, as you can see in this online converter:
Hope it helps!
Upvotes: -1