Numeral-js icon indicating copy to clipboard operation
Numeral-js copied to clipboard

Fix formatting for small numbers.

Open EthanRBrown opened this issue 5 years ago • 4 comments

Fixes #596. Formatting numbers smaller than approximately 1e-6 resulted in NaN (instead of a formatted string). This was due to coercing the numeric value to a string and adding an exponential notation to that; however, small numbers coerce to exponential representation anyway, so it was getting that notation twice. In other words, 1e-7 would result in the string 1e-7e+0 (for example), which was not parsing correctly.

Note that this is redundant with PR #635: when I was formatting this PR, I thought I'd look at some other PRs to see what the convention for PRs was, and lo and behold, the first one I found was a fix for this exact issue. My fix is a more compact, but may exhibit undesirable behavior when formatting very small numbers (when the format can actually go down that low).

A bigger concern is what's the status of maintenance of this package?

EthanRBrown avatar May 09 '19 23:05 EthanRBrown

I wonder what's the status of this whole project too, since I collected 4 PRs addressing this issue. Other PRs correct minor issues which could be easily merged as well.

MrCsabaToth avatar May 30 '20 02:05 MrCsabaToth

Yeah, @MrCsabaToth, I think this project is dead in the water. Seems like https://github.com/BenjaminVanRyseghem/numbro is the new numeral.js :/

EthanRBrown avatar Jun 01 '20 05:06 EthanRBrown

I wonder if @adamwdraper would hand over the project to someone who could crunch over all the PRs and merge many at least. Thanks for the tip I'll check that other project out.

MrCsabaToth avatar Jun 01 '20 07:06 MrCsabaToth

👀

felansu avatar Nov 18 '21 16:11 felansu