adamwdraper / Numeral-js

A javascript library for formatting and manipulating numbers.
http://numeraljs.com
MIT License
9.65k stars 926 forks source link

Error when numeral(999.999).format('0,0.[00] a') #788

Open tianxiuali opened 1 year ago

tianxiuali commented 1 year ago

Example:

numeral(999.999).format('0,0.[00] a')

The result is "1", not "1 k".

Also in another example:

numeral(999999.999).format('0,0.[00] a')

The result is "1 k", not "1 m".

hungtcs commented 1 day ago

I have a similar problem, but there should be no spaces in your formatting.

// should be 1k
console.log(numeral(999.999).format("0,0.[00]a")); // 1,000

// that's right
console.log(numeral(999999.999).format("0,0.[00]a")); // 1m