-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
toLocaleString wrong format on Android #16867
Comments
Pretty much same as #12597 So yes, it's JSC version on Android being old and not supporting localization methods to the full extent. If you're ambitious about it maybe you can try https://github.com/SoftwareMansion/jsc-android-buildscripts#international-variant-1 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions. |
This issue must exist. |
The same issue is with me |
Using react-native 0.50.4 Could get arround the issue by using Currency Formatter Still, would be nice to have this working |
Thanks for posting this! It looks like you may not be using the latest version of React Native, v0.53.0, released on January 2018. Can you make sure this issue can still be reproduced in the latest version? I am going to close this, but please feel free to open a new issue if you are able to confirm that this is still a problem in v0.53.0 or newer. |
Issue still present in the latest version. |
Issue still present |
I also encountered this issue. Too bad I was only testing on iOS so I got puzzled when things are breaking for Android. Turns out Had to use the following function as an alternative for formatting the date: getLocalDateTime(new Date());
function getLocalDateTime(date) {
let hours = date.getHours();
if (hours < 10) hours = '0' + hours;
let minutes = date.getMinutes();
if (minutes < 10) minutes = '0' + minutes;
let timeOfDay = hours < 12 ? 'AM' : 'PM';
return date.getMonth() + '/' + date.getDate() + '/' +
date.getFullYear() + ', ' + hours + ':' + minutes + " " + timeOfDay;
} |
- replace with a function which does the same thing
Guys nothing to do? |
It's a real shame, to those who are using `
} |
Still having this issue. |
Still having the same issue |
Same issue here as well. This should be prioritised considering the fact that this is a basic platform feature. |
Same issue. |
@kern3lpan1c It's been requested by the FB bot to open a new issue with same content, are you up for doing that and just pasting in the same content? (Replying in this thread looks like it will not come to maintainers' attention at all.) |
I believe this is a problem with the JavaScriptCore that comes with Android and not a React Native bug. It should be resolved by shipping an alternative core: |
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
Environment:
OS: macOS Mojave 10.14.1
Node: v11.1.0
Yarn: 1.12.3
npm: 6.4.1
Watchman: 4.9.0
Xcode: Xcode 10.0 Build version 10A255
Android Studio: 3.1.3 Build #AI-173.4819257
Packages: (wanted => installed)
react: 16.4.1 => 16.4.1
react-native: 0.56.0 => 0.56.0
Target Platform: Android (8.0)
Steps to Reproduce
Expected Behavior
The expected string should be as follows:
Actual Behavior
The resulting string is as follows:
My contention is that this is an issue with the underlying JS engine that Android uses, and handles it differently as opposed to the integrated JS engine on iOS, hence the variance in the date format. For this reason if you open a remote debugged, say on Chrome, you will actually get the correct format, due to the different JS engine handling it, but if you switch off the debugger and resume using the application whilst not debugging remotely, the incorrect format will be shown.
Reproducible Demo
Here's an example Expo project that shows the behaviour, toggle between iOS and Android to see the difference in the output.
https://snack.expo.io/Bk3unwhyM
EDIT: Updated environment in which this is still reproducible.
The text was updated successfully, but these errors were encountered: