-
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 has erroneous format on Android #22652
Comments
Thanks for the report. We're working on upgrading the JS VM that is bundled in Android, lets check back up on this issue once that task is done. |
Excellent news, thanks for the update. |
I get inconsistencies when using |
The JSC was updated on Android. This will be reflected in release 0.59, and is already available on master. |
@hramos the updated JSC doesn't include the |
In that case, you'll need to follow the instructions at https://github.com/react-native-community/jsc-android-buildscripts for building your own JavaScriptCore flavor, with Intl included. As of 0.59, the JSC is pulled from npm, so pointing your project to use an arbitrary JSC build should be straightforward. I believe there's ongoing work to reduce the friction here in a future release, but for now I'll leave this closed as we don't intend to switch the default JSC at this time. |
For Android use For both ios and android |
You don't have to implement entire JSCore for this. Check my answer here. Hope this helps others too. |
In my opinion |
This is still broken. Running I'm running React Native 0.59.8, with the latest JSC from Unsure what else I need to do here to get it to work. I would have thought using the JSC with Intl compiled into it would result in the essentially the same JSC as ships with the iPhone. |
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.57.0 => 0.57.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
Related:
#12597 #16867
The text was updated successfully, but these errors were encountered: