facebook / facebook/hermes

Intl.NumberFormat on Android with style: 'currency' and signDisplay: 'always' truncates currency sign for positive values

Open
#789 4 comments 6 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
11.3k
Forks
859
Avg merge
1h 30m
Merged PRs (30d)
3

Description

## Bug Description

When you use `Intl.NumberFormat` number with `style: 'currency'` and `signDisplay: 'always'` it works well enough for negative numbers, but as soon as you try it with a positive number it just removes the currency sign. See the code below.

This problem only occures on Android

This is not relevant as Intl doesn't work with JSC:
- [x] I have run `gradle clean` and confirmed this bug does not occur with JSC

Hermes version: hermes-engine@0.11.0
React Native version: 0.69.3
Platform: arm64-v8a

## Steps To Reproduce

```
const App = () => {
return (


{new Intl.NumberFormat('en-US', {style: 'currency', currency: 'EUR', signDisplay: 'always'}).format(100.32)}
{'\n'}
{new Intl.NumberFormat('en-US', {style: 'currency', currency: 'EUR', signDisplay: 'always'}).format(-100.32)}
{'\n'}
{new Intl.NumberFormat('en-US', {style: 'currency', currency: 'EUR', signDisplay: 'auto'}).format(100.32)}
{'\n'}
{new Intl.NumberFormat('en-US', {style: 'currency', currency: 'EUR', signDisplay: 'auto'}).format(-100.32)}
{'\n'}

{!!global.HermesInternal ? 'Hermes' : 'JSC'}


);
};
export default App;
```

Produces the following output on Android:
```
+100.32
-€100.32
€100.32
-€100.32
```

For iOS and Web it produces the correct output:
```
+€100.32
-€100.32
€100.32
-€100.32
```

## The Expected Behavior

`Intl.NumberFormat` should produce the same output on each platform.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.