adamwdraper / Numeral-js

A javascript library for formatting and manipulating numbers.

Home Page:http://numeraljs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect abbreviations for values rounded up

gscottolson opened this issue · comments

There is a specific case in Numeral where values with abbreviation formats are not rounded up properly to the next abbreviation. There are two test cases I added (locally) that fail to format properly:

...
[999950,'0.0a','1m'],
[999999999,'0.0a','1b'],
...

The above cases will output incorrect abbreviation values:

999950 ⟶ 1000.0k
999999999 ⟶ 1000.0m

The logic around abbreviation bracketing is causing this issue. I tried creating a patch for this, but I couldn’t find a quick solution that didn’t introduce additional test failures.