visionmedia / bytes.js

node byte string parser
MIT License
458 stars 57 forks source link

Thousands separator doesn't respect decimal points #51

Closed rognales closed 2 years ago

rognales commented 4 years ago

This is my sample code

var bytes = require('bytes');
var options = {thousandsSeparator: ',', decimalPlaces: 4, unit: 'GB', fixedDecimals:false, unitSeparator: ' '}
bytes(10241456, options);

Here's the output

"10,001.4,219 KB"

My expectation was

"10,001.4219 KB"
rognales commented 4 years ago

Pardon me if this is due to locale setting as i cant find any

dougwilson commented 2 years ago

It certainly seems like a bug to me, as thousands separators do no belong on the right-hand side of the decimal :)

rognales commented 2 years ago

3.1.1 fixes this!

Thanks for your great effort.

dougwilson commented 2 years ago

No problem @rognales . And sorry for letting this sit for so long. Going through and working though my huge backlog little bits at a time and happy to hear back that it helped :)