-
Notifications
You must be signed in to change notification settings - Fork 117
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
RangeError: Invalid time zone specified:
error caused by usage of formatInTimeZone
function for some folks
#264
Comments
RangeError: Invalid time zone specified:
error caused by usage of formatInTimeZone
function for some folksRangeError: Invalid time zone specified:
error caused by usage of formatInTimeZone
function for some folks
Still facing the same issue for this |
Same issue happening for me in react native |
We are having the same issue in React Native for Asia/Kolkata |
After doing some research, my impression is that Intl.DateTimeFormat is system specific, and the Asia/Kolkata issue only happens on iOS (at least based on the errors we have seen in Sentry). Based on facebook/hermes#1100, we decided to manually map Asia/Kolkata to Asia/Calcutta in our code before passing the timezone to date-fns-tz. And that seemed to have helped. |
I just had this error thrown. After wrestling with it for hours and tracing the issue to the same line as OC, I realized/found the problem was not with my timezone parameter, but with my date string (the first parameter) which was a string. I don't know why this error was getting thrown in my case, but it was very misleading for the error to flag where it did with the message it did. After changing to a UTC epoch timestamp (number), I haave has zero problems, including the timezones all of the above commenters have listed. |
Here we are having the same issue with |
having the same issue with Africa/Johannesburg |
Our DataDog was reporting this error --
RangeError: Invalid time zone specified:
-- for about 15 different users internationally. The time zones it would list are definitely not invalid. Some included:The stack trace pointed to
getTimeZoneOffSet
:It's failing at
tzParseTimezone
, particularly where it checksisValidTimezoneIANAString(timezoneString)
. That function relies on the existence ofIntl.DateTimeFormat
to determine if a time zone is valid or not. Which doesn't work for everyone.Would it be possible to use a different way to check in
isValidTimezoneIANAString
? Thank you! 🙇The text was updated successfully, but these errors were encountered: