Bug Description
Intl.NumberFormat.prototype.format() throws TypeError: Cannot convert BigInt to number when passed a bigint argument on Android. The same code works correctly in V8 (Chrome) and SpiderMonkey (Firefox).
Hermes git revision (if applicable): bundled with React Native 0.81.5
React Native version: 0.81.5
OS: Android
Platform: arm64-v8a
Steps To Reproduce
- Create a React Native app with Hermes enabled (default for RN 0.81.5)
- Run on an Android device or emulator
- Execute any of the following:
// All three crash with: TypeError: Cannot convert BigInt to number
new Intl.NumberFormat().format(BigInt('2'))
new Intl.NumberFormat('en-US').format(BigInt('2'))
new Intl.NumberFormat().format(2n)
The crash occurs regardless of whether the bigint is created via the BigInt() constructor or a bigint literal (2n), and regardless of whether a locale argument is provided.
Workaround:
new Intl.NumberFormat().format(Number(BigInt('2'))) // ✅ returns "2"
The Expected Behavior
All three expressions should return "2" without throwing, as bigint is a valid argument per ECMA-402 and works correctly on V8 and SpiderMonkey.
Related open issues:
Bug Description
Intl.NumberFormat.prototype.format()throwsTypeError: Cannot convert BigInt to numberwhen passed abigintargument on Android. The same code works correctly in V8 (Chrome) and SpiderMonkey (Firefox).gradle cleanand confirmed this bug does not occur with JSCHermes git revision (if applicable): bundled with React Native 0.81.5
React Native version: 0.81.5
OS: Android
Platform: arm64-v8a
Steps To Reproduce
The crash occurs regardless of whether the
bigintis created via theBigInt()constructor or a bigint literal (2n), and regardless of whether a locale argument is provided.Workaround:
The Expected Behavior
All three expressions should return
"2"without throwing, asbigintis a valid argument per ECMA-402 and works correctly on V8 and SpiderMonkey.Related open issues:
Intl.NumberFormatsignDisplaycan't always display signIntl.NumberFormatsignDisplay: 'always'truncates currency sign on Android