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

bug: Local timezone set to 'America/Indianapolis' causes error #72

Closed
ajorkowski opened this issue Jan 10, 2018 · 3 comments
Closed

bug: Local timezone set to 'America/Indianapolis' causes error #72

ajorkowski opened this issue Jan 10, 2018 · 3 comments

Comments

@ajorkowski
Copy link

Hi,

I'm using latest react-time, moment and moment-timezone and getting the following issue:

tz.guess() is returning America/Indianapolis (I'm not sure how they chose it, but they were on a mac so I assume that uses more precise IANA timezones). However if you execute getTzForName('America/Indianapolis') you actually get an undefined because it is not in the mapping? This causes an error in the getValidTimeData function, since it tries to get the zoneName from the result of that function.

Looking at this closer ... it looks like the mapping actually has "America/Indiana/Indianapolis" not "America/Indianapolis". It looks like both actually link to a different tz, which in turn links to something else.

I can't work out a way to 'normalize' the timezone unfortunately... Maybe the best way to deal with it is to make sure we always return a valid value in the guessUserTz function: return getTzForName(userTz) || { city: fallbackName(userTz), zoneName: userTz, zoneAbbr: (0, _momentTimezone2.default)().tz(userTz).zoneAbbr() }. This might cause the dropdown to not have something selected, but I think that is better than react-times not working at all.

@ecmadao
Copy link
Owner

ecmadao commented Jan 11, 2018

Hey ajorkowski, thanks for your feedback! But now I'm trekking in Tibet and Nepal, so I can't fix it until early February. Anyway, thanks for yourhelp!

@ecmadao
Copy link
Owner

ecmadao commented Jun 21, 2018

Yes, 'America/Indianapolis' is missing in timezone map, but it has 'America/Indiana/Indianapolis'. I'll fix it in next version. THX! @ajorkowski

@ecmadao
Copy link
Owner

ecmadao commented Jun 21, 2018

v3.1.1 published.

@ecmadao ecmadao closed this as completed Jun 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants