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

guess returns obsolete timezones (likely due to Intl) #873

Open
trevorgehman opened this issue Jul 15, 2020 · 2 comments
Open

guess returns obsolete timezones (likely due to Intl) #873

trevorgehman opened this issue Jul 15, 2020 · 2 comments

Comments

@trevorgehman
Copy link

I'm running into a situation where moment.tz.guess() is returning the obsolete timezone America/Indianapolis instead of the correct America/Indiana/Indianapolis. I'm not familiar enough with the intricacies of how this library is processing the IANA data, but I just wanted to post this issue in case others are running into it.

Not sure whether it's related to this (#835) which specifically mentions the America/Indiana/Indianapolis timezone.

@trevorgehman
Copy link
Author

I think this is actually related to this issue: #687

On the latest Mac OSX you can set your timezone and it looks like legacy timezones are sometimes used, such as America/Montreal and America/Indianapolis. Then in Safari and Chrome that is what is returned:

Intl.DateTimeFormat().resolvedOptions().timeZone
"America/Indianapolis"

I imagine that the only workaround is to check if a legacy timezone is an alias of another timezone (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#Legend) and then return the correct timezone.

@ichernev
Copy link
Contributor

@trevorgehman well, there are 2 parts in this, if guess indeed uses Intl in your case, then it is "not our problem". Maybe it could make sense to add an API/option to only do the manual guessing and not rely on broken Intl implementation, that would be more configurable.

Could you modify the rebuildGuess function to not use Intl and see if the problem persists?

@ichernev ichernev changed the title guess() returns America/Indianapolis instead of America/Indiana/Indianapolis guess returns obsolete timezones (likely due to Intl) Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants