Intl.NumberFormat does not interpret strings as decimal
- Dominant language
- JavaScript
- Stars
- 11.3k
- Forks
- 865
- Avg merge
- 1h 30m
- Merged PRs (30d)
- 3
Description
### Description
In modern browsers, you can pass strings to Intl.NumberFormat.format so that you do not lose precision. This is especially important when formatting financial information.
### Steps to reproduce
Run the following on React Native:
```
console.log(
new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(
"999_999_999_999_999_999_999_999_999_999".replaceAll("_",""),
),
);
```
It outputs (on Android and iOS):
`1.000.000.000.000.000.000.000.000.000.000,00 €`
If you run the above code snippet in a browser it will output:
`999.999.999.999.999.999.999.999.999.999,00 €`
### React Native Version
0.73.6
### Affected Platforms
Runtime - iOS
### Output of `npx react-native info`
```text
info Fetching system and libraries information...
System:
OS: macOS 14.4.1
CPU: (10) arm64 Apple M1 Max
Memory: 3.85 GB / 64.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.14.1
path: ~/.nvm/versions/node/v18.14.1/bin/node
Yarn:
version: 4.1.1
path: ~/.nvm/versions/node/v18.14.1/bin/yarn
npm:
version: 9.3.1
path: ~/.nvm/versions/node/v18.14.1/bin/npm
Watchman:
version: 2024.04.08.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.5
- iOS 17.5
- macOS 14.5
- tvOS 17.5
- visionOS 1.2
- watchOS 10.5
Android SDK: Not Found
IDEs:
Android Studio: 2023.1 AI-231.9392.1.2311.11330709
Xcode:
version: 15.4/15F31d
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.6
path: /usr/bin/javac
Ruby:
version: 3.2.2
path: /Users/nudom/.rubies/ruby-3.2.2/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false
info React Native v0.74.1 is now available (your project is running on v0.73.6).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.74.1
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.74.1
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".
```
### Stacktrace or Logs
```text
N/A
```
### Reproducer
N/A
### Screenshots and Videos
_No response_
Contributor guide
Research direction
Start by running the provided Intl.NumberFormat example with Hermes in React Native 0.73.6 on iOS and Android, then compare its output with a modern browser. Trace the string-formatting path responsible for the precision difference. Done means large decimal strings produce the same precise formatted value as the browser without being rounded.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- internationalization, mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100