currency-formatter
currency-formatter copied to clipboard
Incorrect format for Indian Rupees (INR)
Said I would raise this for awareness.
We had this formatting issue internally and was going to look into using an external module, but it seems to be commonly overlooked.
https://en.wikipedia.org/wiki/Indian_numbering_system
What would be the correct format?
Leaving the current format here for convenience:
"INR": {
"code": "INR",
"symbol": "₹",
"thousandsSeparator": ",",
"decimalSeparator": ".",
"symbolOnLeft": true,
"spaceBetweenAmountAndSymbol": false,
"decimalDigits": 2
},
Hi @edorivai,
Thanks for that, great package by the way.
The first thousand is ,
then it is separated by every hundred there after.
e.g (100000000).toLocaleString('en-IN')
= 1,00,00,00,000
Oh my, I don't think the accounting
package supports formatting in that fashion.
Oh! that's interesting...
@edorivai is right! The accounting library doesn't support this kind of formatting.
openexchangerates/accounting.js#113 openexchangerates/accounting.js#141
Personally I'd suggest the Intl
API:
new Intl.NumberFormat('en-IN', { style: 'currency', currency: 'INR' }).format(100000000)
// => "₹ 10,00,00,000.00"