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

Format decimal numbers #68

Closed
karellm opened this issue Jun 27, 2015 · 2 comments
Closed

Format decimal numbers #68

karellm opened this issue Jun 27, 2015 · 2 comments

Comments

@karellm
Copy link

karellm commented Jun 27, 2015

I stumble uppon your repo while skimming the many numeral.js issues. I'm trying to do some very basic formatting: 123456.123456 to 123'456.123456. Or in words:

  1. Format the part before the period
  2. Leave decimals untouched

numeral.js and numbro both seem to require you to know the number of decimals ahead or setting a big number (which will generate extra 0 at the end of the number).

Am I missing something? Thanks!

@BenjaminVanRyseghem
Copy link
Owner

for the first bullet, you can try ,0 as format

for the second bullet, I do not know if leaving the decimal untouched is supported (yet?)
I tried something like 0. but it didn't work (as you can see here)

I will have a deeper look tomorrow, and hopefully propose a fix for it

@karellm
Copy link
Author

karellm commented Jun 28, 2015

I forgot to mention I tried all I could think of: 0,0[.0000000000], 0,0[.]0000000000 or alike.

If I can make a suggestion, I would borrow regex syntax here: 0,0[.]0* where * pretty much means any number of digits including none.

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

2 participants