I'm trying to use moment to create a calendar ics file with the appropriate timezone, but since moment uses IANA timezone format and Outlook doesn't, i'm needing to find some way of converting the IANA name to windows so it recognizes the timezone name. It would be great if you had some function to get the Windows-compatible timezone name. Not like i'm in love with windows or anything, but everyone seems to have outlook.
Thanks!
Somehow use this to do it maybe: http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml
Yes, the CLDR map you linked to is the authoritative file for conversions between Windows and IANA time zones, and I can see benefit in having the mappings available in moment-timezone. Though it would probably best to have the data itself in a separate file.
FYI, if you are using .NET on the back-end, you can use my code from here which uses Noda Time to do the conversions.
For moment-timezone, we should be able to implement this in pure JavaScript. We can probably come up with a compact form to compile the mapping data into as well.
After rethinking this some time later - I don't believe it is beneficial to perpetuate Microsoft time zone identifiers outside of their current scope. Those that are using them in .NET code can convert to standard IANA time zone IDs in their .NET code.
See also #130
FYI - My TimeZoneConverter C# library may be useful to folks working with C# TimeZoneInfo on the back end and moment-timezone on the front end.
Hi @bostondevin , I'm facing the same problem converting windows timezones to IANA timezone. one approach I'm planning to use noda time library and create a map json like
var zones = {
"Pacific Standard Time" : "America/Los_angeles",
"Indian Standard Time" : "Asia/Calcutta"
}
and use this map in my node application.
I would like to know if there is a better way of doing this.
I created a gist to convert from Windows timezone names to IANA. It's just a hash of names. It uses the 001 territory for each zone from the unicode.org list. I'm pretty sure daylight saving should be correct for each zone, but no responsibility taken.
https://gist.github.com/danderson00/c03d46dfc38486ea7b06da9f75c7a63f
I have created a list of moment-timezone links for all Outlook/MS timezone names from [/https://support.microsoft.com/en-us/help/973627/microsoft-time-zone-index-values]. If there is support, I will open a pull request to add them to the standard links.
Most helpful comment
I created a gist to convert from Windows timezone names to IANA. It's just a hash of names. It uses the
001territory for each zone from the unicode.org list. I'm pretty sure daylight saving should be correct for each zone, but no responsibility taken.https://gist.github.com/danderson00/c03d46dfc38486ea7b06da9f75c7a63f