-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Weird behavior of FormattedDateTimeRange
in React Native
#4535
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
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Still an issue. Any updates? |
for the tz issue there's no way for JS to know default timezone so you have to set |
Well, it does work perfectly when I remove the polyfills (and test with |
Because native browsers have access to that, JS does not. You can read the doc here https://formatjs.github.io/docs/polyfills/intl-datetimeformat#default-timezone |
Ah my bad, thanks for clarifying. Do you also have any idea on the second issue, the date and day that are duplicated? |
It's unfortunately non-trivial to fix so I'll keep this open/pinned until I have time to fix it. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This is still an issue. |
@longlho Is there any update on this? π |
unfortunately nope :( |
Which package?
react-intl
Describe the bug
I am using
FormattedDateTimeRange
in a React Native application with the following setup:When the
from
andto
dates fall on the same day (with different times), I expect the output to be:Sun, 22 Sept, 14:00β16:00
However, the actual output I see is:
Sun, 22 Sept, 12:00βSun, 22 Sept, 14:00
There are two issues here:
When I remove the polyfills and use
FormattedDate
for testing, it correctly respects the device timezone, which makes me suspect this is an issue with the polyfills. Both of these issue don't occur in a normal browser environment (react, not react-native).To Reproduce
Add the following polyfills:
Component example:
Expected behavior
Sun, 22 Sept, 14:00β16:00
when the from and to dates are the same day.FormattedDate
to test)Smartphone:
Additional context
Thanks in advance for helping, really appreciate what you guys are building!
The text was updated successfully, but these errors were encountered: