globalizejs / globalize

A JavaScript library for internationalization and localization that leverages the official Unicode CLDR JSON data
https://globalizejs.com
MIT License
4.8k stars 602 forks source link

Formatting negative numbers with compact: 'short' uses wrong units #805

Closed shivijais closed 6 years ago

shivijais commented 6 years ago

Using version - '1.4.0-alpha.0'

let formatter = Globalize.numberFormatter({
    compact: short,
    maximumSignificantDigits: 3,
    minimumSignificantDigits: 1
});
formatter(-230); //-0.23K . Expected => -230
formatter(-230000); //-0.23M . Expected => -230K
formatter(-230130000); //-0.23B . Expected => -230M
formatter(-230000000000); //-0.23T . Expected => -230B
rxaviers commented 6 years ago

Thank you for reporting this