Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Incorrect format for Indian Rupees (INR) #57

Open
GearoidCollins opened this issue May 15, 2018 · 4 comments
Open

Incorrect format for Indian Rupees (INR) #57

GearoidCollins opened this issue May 15, 2018 · 4 comments

Comments

@GearoidCollins
Copy link

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

@edorivai
Copy link
Collaborator

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
  },

@GearoidCollins
Copy link
Author

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

@edorivai
Copy link
Collaborator

Oh my, I don't think the accounting package supports formatting in that fashion.

@smirzaei
Copy link
Owner

smirzaei commented May 17, 2018

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"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants