Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GMT+03:00 Asia/Baghdad instead of Europe/Moscow #290

Closed
alealex opened this issue Jan 14, 2016 · 6 comments
Closed

GMT+03:00 Asia/Baghdad instead of Europe/Moscow #290

alealex opened this issue Jan 14, 2016 · 6 comments
Labels

Comments

@alealex
Copy link

alealex commented Jan 14, 2016

I have
moment.js version : 2.11.1
moment-timezone.js version : 0.5.0
os windows 7

If I set timezone to UTC+3 Moscow, St.Petersburg, Volgograd (RTZ 2) then the following code
"GMT" + moment().format('Z') + ":" + moment.tz.guess()
will produce GMT+03:00:Asia/Baghdad

expected result is GMT+03:00:Europe/Moscow

http://jsfiddle.net/3javhx7k/2/

navigator.appVersion is "5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.91 Safari/537.36"

@mattjohnsonpint
Copy link
Contributor

@timrwood - While some guesses will certainly be wrong, in this particular case we can fix the problem by using the Intl api when available.

@sompylasar
Copy link

Be careful, the Intl API returns Asia/Riyadh in Chrome, so we cannot actually rely on the Intl API, that being a shame for Chrome, but nevertheless.

> Intl.DateTimeFormat().resolvedOptions().timeZone
"Asia/Riyadh"

Note that none of the guessed candidates in zoneScores is Europe/Moscow, so there's something wrong with guessing.

@sompylasar
Copy link

sompylasar commented Aug 5, 2016

http://pellepim.bitbucket.org/jstz/ did this right somehow, resolves to Europe/Moscow.

UPDATE the latest version did this wrong, but the one I use, 1.0.5, did this right.

@mattjohnsonpint
Copy link
Contributor

Intl APIs in newer Chrome does work now. They used to resolve incorrectly, but that was fixed awhile back (not sure exactly when).

Also, I tested against latest (0.5.13) in IE - which uses the guessing algorithm - and it does now return Europe/Moscow.

@sompylasar
Copy link

@mj1856 Chrome bug here but marked as Started, not Fixed as of now. https://bugs.chromium.org/p/v8/issues/detail?id=3547

@mattjohnsonpint
Copy link
Contributor

mattjohnsonpint commented Apr 12, 2017

@sompylasar - Yeah, that bug is still present. However, I don't think it affects us, since Chrome still correctly returns Europe/Moscow for the default time zone via Intl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants