-
Notifications
You must be signed in to change notification settings - Fork 837
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
Guess should ignore Intl detection bad results #423
Comments
I also vote for such an option. I work on a cordova app on Windows 10 tablet and there the Microsoft Edge Browser Engine will be used. I noticed that the call to "Intl.DateTimeFormat().resolvedOptions().timeZone" always returns a cached value. Steps to reproduce the problem:
This procedure works in Chrome without problems. Chrome noticed the changed timezone. So Microsoft has a bug or a "cache feature" ;-) in his Intl.DateTimeFormat() implementation. And because moment-timezone uses this Intl Feature, the moment.tz.guess(true) method also returns the wrong timezone in my cordova app (Edge Browser Engine). If I remove the Intl Feature at the beginning by doing: then moment-timezone always guesses the correct timezoneId in my win 10 cordova app. |
I'm not concerned about the cached part. Various browsers have gone either way on that over the years. If you're concerned about that, raise an issue with Edge / ChakraCore. I do think it would be good to make sure Intl returned a zone with a For now, you could simply remove (or don't add) the zones that use three-letter abbreviations instead of full identifiers. |
To clarify - a true/false option isn't very useful IMHO, but ignoring bad results is. |
Sometimes, the Internationalization API doesn't return sensible values. I encountered that in Chrome for Android, where it returns "CET" instead of a timezone ID when the selected system timezone is using Central European Time.
Currently, I'm removing
Intl.DateTimeFormat
before callingmoment.tz.guess(true)
again. That's not really a nice solution, so can an option be added to bypass it?The text was updated successfully, but these errors were encountered: