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

Why is 0 formatted as +0? #78

Closed
marceloverdijk opened this issue Aug 1, 2015 · 13 comments
Closed

Why is 0 formatted as +0? #78

marceloverdijk opened this issue Aug 1, 2015 · 13 comments

Comments

@marceloverdijk
Copy link

var string = numbro(-1).format('+0,0');
// '-1'

var string = numbro(1).format('+0,0');
// '+1'

var string = numbro(0).format('+0,0');
// '+0'

The last one I would expect just 0 without a + prefixed.

@marceloverdijk marceloverdijk changed the title Why is 0 printed as +0? Why is 0 formatted as +0? Aug 1, 2015
@BenjaminVanRyseghem
Copy link
Owner

I tend to disagree as you are forcing the sign to be displayed 😄

@marceloverdijk
Copy link
Author

How would I then configure to only display a + for 'real' positive numbers (not 0 :-))

@BenjaminVanRyseghem
Copy link
Owner

I have no idea 😛

@marceloverdijk
Copy link
Author

Haha :-)

@clayzermk1
Copy link
Contributor

I'm going to take a stab at this.

clayzermk1 added a commit to clayzermk1/numbro that referenced this issue Aug 10, 2015
Zero values should not show up as positively formatted values when using '+'.
Added test for 0 and '+'.
Fixes BenjaminVanRyseghemGH-78.
@marceloverdijk
Copy link
Author

Thanks! I guess this will be part of 1.5.1?

@BenjaminVanRyseghem
Copy link
Owner

@marceloverdijk indeed

I will see if I can update today 😉

@marceloverdijk
Copy link
Author

Would be great 👍

@BenjaminVanRyseghem
Copy link
Owner

In numbro 1.5.1

@marceloverdijk
Copy link
Author

Created issue on CDNJS to publish there: cdnjs/cdnjs#5307

@BenjaminVanRyseghem
Copy link
Owner

good 😄

but 1.5.0 is not in CDNjs, there is like 7 versions missing there 🐼

@marceloverdijk
Copy link
Author

@BenjaminVanRyseghem
Copy link
Owner

good to know ;)

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

3 participants