You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Intl.NumberFormat has a notation option that handles truncating a number and displaying formatting as text. This doesn't work with notation: 'compact' and the associated compactDisplay option.
// Tested with other locales without any difference.constlocale='en-US'constnumberFormatter=newIntl.NumberFormat(locale,{notation: 'compact'})constpercentFormatter=newIntl.NumberFormat(locale,{style: 'percent',notation: 'compact'})constnumberLongFormatter=newIntl.NumberFormat(locale,{notation: 'compact',compactDisplay: 'long'})constpercentLongFormatter=newIntl.NumberFormat(locale,{style: 'percent',notation: 'compact',compactDisplay: 'long'})numberFormatter.format(123456789)// Displays "123,456,789", but should display "123M"percentFormatter.format(1234)// Displays "123,400 %", but should display "123K%"numberLongFormatter.format(123456789)// Displays "123,456,789", but should display "123 million"percentLongFormatter.format(1234)// Displays "123,400 %", but should display "123 thousand%"
Thanks for reporting this, this has previously been discussed in #1035, so closing it as a duplicate. Our current approach to Intl on iOS makes this difficult to implement, but we intend to redesign our Intl implementation in the long term to add support for a broader set of functionality.
Description
Intl.NumberFormat
has a notation option that handles truncating a number and displaying formatting as text. This doesn't work withnotation: 'compact'
and the associatedcompactDisplay
option.Might be related to #1317
Steps to reproduce
React Native Version
0.73.4
Affected Platforms
Runtime - iOS
Output of
npx react-native info
Stacktrace or Logs
Reproducer
https://snack.expo.dev/dgxZ741GIb4EfFyAnyQYp
Screenshots and Videos
The text was updated successfully, but these errors were encountered: