currency.js icon indicating copy to clipboard operation
currency.js copied to clipboard

Use Intl.NumberFormat for formatting values

Open scurker opened this issue 5 years ago • 3 comments

Formatting is already pretty versatile, but we could also potentially leverage Intl.NumberFormat to get a lot of different formats for "free". The one downside is that it's possible that parsing and formatting are out of sync if the options aren't the same.

scurker avatar Jul 29 '19 22:07 scurker

Just a heads up; Intl isn't available in react-native's JavaScriptCore in Android (hence why I'm looking at this library).

kg-currenxie avatar Mar 16 '20 09:03 kg-currenxie

Exactly! I'm using Currency.JS to replace missing react-native's Intl API.

I got Intl working react-native changing the jscFlavor, but it increased the build size in 6MB!

mayconmesquita avatar Oct 28 '20 15:10 mayconmesquita

:-1: for this — while it is super convenient and provides a much broader support in terms in i18n, in a recent version of chrome they changed how they formatted numbers without a currency specified (we're using Dinero.js) leading to local currencies across the world being formatted as "USD$9.99". There is an argument for just keeping it simple and explicit.

grrowl avatar Feb 01 '21 10:02 grrowl