0

We have angular application that suppose to convert UTC datetime to User's Timezone. For this we are using moment.js

The Timezone user selects during registration is using the Windows TimeZoneInfo and we store the User's Timezone value as TimeZoneInfo.Id. Now this is a String value that I want to map with moment.js timezones.

So when I tried "moment("2015-02-25T08:57:54").tz('Eastern Standard Time').format('YYYY-MM-DD HH:mm a')" to covert to users timezone, it give error as Moment Timezone has no data for Eastern Standard Time. See http://momentjs.com/timezone/docs/#/data-loading/.

I am using "http://momentjs.com/downloads/moment-timezone-with-data.min.js" which I suppose to have all timezones. I have also gone through documnets and found that moment uses IANA Time Zone data and not Windows Timezone data

So my querires are:

  1. Am I missing on moment timezone data and isn't the above file have all the timezone data?
  2. Is the data in above file changes continuously ?
  3. How can I keep a track of latest moment.js timezone data ?
  4. How I can accurately map TimeZoneInfo.Id to moment.js timezone ?
D Deshmane
  • 1,125
  • 4
  • 15
  • 27
  • IANA data changes often, as time zones around the world changes often. You can subscribe to the tz announcement list [here](http://www.iana.org/time-zones). Moment-timezone releases follow shortly after. – Matt Johnson-Pint Apr 07 '15 at 16:06
  • Thank you Matt. I will take care of this, just a quick question: As I am using "moment-timezone-with-data.min.js" for TimeZone data and eventually conversion as well, do this file will be updated when IANA database updated ? If so, I can download this file on fly enabling meto have latest Timezone data every time. Please comment on this – D Deshmane Apr 08 '15 at 11:07
  • There's currently no built-in automatic update procedure for moment-timezone. I added [a work item for that](https://github.com/moment/momentjs.com/issues/191). The file does get updated periodically on the moment-timezone website, but it's currently a manual effort. Right now, the site is hosting 2015a, and we're getting ready to post 2015b. You can always update your own copy of the data by following [the instructions here](https://github.com/moment/moment-timezone/blob/develop/contributing.md). But yes - it's wise to update your code periodically with the new data. – Matt Johnson-Pint Apr 08 '15 at 16:50
  • FYI - Even for Microsoft time zones in your .NET code, you should monitor the news feed on [microsoft.com/time](http://microsoft.com/time) and apply hotfixes as necessary. Windows Update only pushes out the *cumulative* updates (twice annually) - not the hotfixes. – Matt Johnson-Pint Apr 08 '15 at 16:52

0 Answers0