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

totalLength negative numbers #425

Closed
jlismore opened this issue Jun 3, 2019 · 3 comments
Closed

totalLength negative numbers #425

jlismore opened this issue Jun 3, 2019 · 3 comments

Comments

@jlismore
Copy link

jlismore commented Jun 3, 2019

This might be a documentation issue rather than a functionality issue.
Per the format documemtation the totalLength option specifies the precision, but it actually seems to limit the final length of the formatted value.
I want to produces numbers formatted to 3sf and per the format docs this seems the right option

numbro(1011).format({totalLength: 3}) // 1.01k
numbro(-1011).format({totalLength: 3}) // -1.0k, expecting -1.01k
@DamienCassou
Copy link
Contributor

This is a change of behavior between numbro 1.11.1 (on the left) and numbro 2.2.0 (on the right):

2020-05-07-153820

@DamienCassou
Copy link
Contributor

The PR #537 fixes this issue:

> numbro(-1011).format({totalLength: 3})
'-1.01k'

@BenjaminVanRyseghem
Copy link
Owner

in numbro 2.3.0

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