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

Currency IRR minor digits incorrect

Open miracle2k opened this issue 9 years ago • 6 comments

Intl.js wants to format the Iranian Rial with two minor digits. It seems that is the information that ISO 4217 contains. I'm in Iran right now, and I don't believe this makes any sense. There shouldn't be any decimal digits on IRR. For what it's worth, the CLDR agrees with me.

miracle2k avatar Mar 14 '16 22:03 miracle2k

@miracle2k can you provide more details? specifically, the exact configuration you're using, the input and the output from the polyfill, and the output from chrome/ff and co.

caridy avatar Mar 15 '16 13:03 caridy

In Chrome:

new Intl.NumberFormat('en', {currency: 'IRR', style: 'currency'}).format(10000) "IRR10,000"

Intl.js: "IRR10,000.00"

miracle2k avatar Mar 15 '16 19:03 miracle2k

Firefox:

new Intl.NumberFormat('en', {currency: 'IRR', style: 'currency'}).format(10000)
"IRR10,000.00"

caridy avatar Mar 15 '16 19:03 caridy

certainly we don't have such information when formatting a number for en locale. Can you link to the CLDR details?

/cc @srl295

caridy avatar Mar 15 '16 19:03 caridy

@caridy locale doesn't determine that aspect. The data should be looked up according to the currency code, irrespective of language. CLDR data for IRR = 0 decimal digits

Update: looks like there's a fixed list at https://github.com/andyearnshaw/Intl.js/blob/master/src/11.numberformat.js#L39 - this should be pulled from CLDR instead probably?

srl295 avatar Mar 15 '16 19:03 srl295

Perfect, I will get this fix for next release.

caridy avatar Mar 16 '16 02:03 caridy