Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Indian and other similar number formats #19

Open
apapirovski opened this issue Nov 2, 2012 · 10 comments
Open

Support for Indian and other similar number formats #19

apapirovski opened this issue Nov 2, 2012 · 10 comments

Comments

@apapirovski
Copy link
Contributor

Was just talking to a friend about this and in parts of India (or maybe everywhere in India) they format numbers like so: 1,00,00,000 (separator after hundreds until the last thousand) which right now, I believe, is impossible to re-create. There are probably other languages too that format their numbers like this or even more differently.

This is probably a substantial change to how Numeral-js does things. To solve, I assume Numeral-js would need to allow functions instead of objects for the "separator" property of a language which would then allow people to write their own custom formatters. The other possibility is allowing them to specify a custom format like so: '00,00,00,00,00,00,000.00' or something, but that seems kind of unwieldy since you have to make it arbitrarily big to make sure it always works.

@lukeapage
Copy link

is you look at the MS C# and Ajax formatting rules, they specify a seperator and then a group size e.g. [2, 3] and you count from the right and if you hit the end of the definition, you repeat. This could easily be added on as an additional option which would default to [3].

@jokeyrhyme
Copy link

http://en.wikipedia.org/wiki/Decimal_mark#Digit_grouping

It looks like China and Japan group them as in 1,0000,0000,0000.

The Indian number system looks like it's the most complex. It appears as though everyone else uses either 3 or 4 digit groupings.

@MSCAU
Copy link

MSCAU commented Jul 3, 2016

Yes, I need Indian currency formatting and will need to roll my own solution...

@TimBailey-pnk
Copy link

Any progress on this?
Thanks

@ooooak
Copy link

ooooak commented Dec 1, 2017

+1 this. Everyone in India uses that format

@sivarajd
Copy link

sivarajd commented Mar 16, 2018

The number format specified above incorrect, and is not as simple. The actual format used is a repeating pattern of groups of 3;2;2. I.e., to write hundred trillion (100,000,000,000,000 or 10E14), you would write as 1,00,00,000,00,00,000. It would be read as one crore crore. One crore basically is 10 million and has seven zeros which are grouped together.

@DilipVxceed
Copy link

DilipVxceed commented Jul 9, 2020

any progress on this ? as kibana use numeral-js , and i have requirement where i want show data abbreviation
as 1 crore instead of 10 million

@ooooak
Copy link

ooooak commented Jul 10, 2020

@DilipVxceed I ended up creating my own package called inrformat.

npm: https://www.npmjs.com/package/inrformat
source: https://github.com/ooooak/inrformat

@Itsmeak0910
Copy link

@ooooak can you tell me how can i use your package in kibana..

@pratik227
Copy link

Hi,

I just forked the repo and made few changes in it and published my own package. Now it supports India currency.

Checkout - https://www.npmjs.com/package/numeral-v2

Doc - https://numeraljs.netlify.app/

Thanks,
Pratik Patel

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

No branches or pull requests

10 participants