Reputation: 23
I have string representing datetime and time zone (IANA) on client side.
How do I get abbreviation for it (like EST/EDT)?
Upvotes: 2
Views: 2061
Reputation: 12416
To do this you can use timezone-js.
Once you set it up (you'll need fresh version of IANA/Olson timezone database, see docs) you can use it to get abbreviation for given datetime and timezone:
var dt = new timezoneJS.Date('10/31/2008', 'America/New_York');
var abbreviation = dt.getTimezoneAbbreviation();
... (abbreviation
will be equal to "EDT"
)
Upvotes: 2