-
Notifications
You must be signed in to change notification settings - Fork 8
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 value #8
Comments
I was running a react-native app on my iPhone 15 simulator with iOS 17.4 on MacOS 14.3.1 (23D60) with 2018 Macbook Pro |
This is a reproduction of this bug: https://codesandbox.io/p/sandbox/datetimeformat-polyfill-timezone-forked-rkdyrp?file=%2Fsrc%2Findex.js%3A20%2C32 The Would you consider updating Line 25 in 23fea6c
|
@CoderCharlie, can you please check what this code returns in your environment: new Intl.DateTimeFormat("en-GB", { timeZone: "Asia/Singapore", hour: "numeric", timeZoneName: "longOffset" }).format(new Date()) I don't have access to the simulator and React Native to test, but @kevin-abiera might be right because of the limited Intl support. @kevin-abiera I guess there must be a way, but what you suggested doesn't work without |
In react-native using expo, that would return something like: "4 pm GMT+08:00". You can test here: https://snack.expo.dev/@lightning18/talking-blue-apple and make sure to switch to "iOS" device on the right. Notice the poor support of timezones hence the need for polyfill. I can't seem to make the polyfill work in snack expo atm but you can test the output here: https://codesandbox.io/p/sandbox/datetimeformat-polyfill-timezone-forked-rkdyrp?file=%2Fsrc%2Findex.js%3A1%2C1-5%2C51. It just always returns something like: "5:53 PM GMT-9:30" I don't think we need the hour here before the GMT? or do we? |
@kossnocorp I created #12. Let me know what you think 🙏🏻 |
Thank you, @kevin-abiera! I shipped the fix with |
I changed it to a few other examples, still got the same error as below
The text was updated successfully, but these errors were encountered: