You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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!
Hi,
I'm using latest react-time, moment and moment-timezone and getting the following issue:
tz.guess()
is returningAmerica/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 executegetTzForName('America/Indianapolis')
you actually get an undefined because it is not in the mapping? This causes an error in thegetValidTimeData
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.The text was updated successfully, but these errors were encountered: