Merge pull request #5464 from techAPJ/100k-format

UX: for numbers greater than 100k allow 0 precision
This commit is contained in:
Jeff Atwood 2018-01-02 00:24:05 -08:00 committed by GitHub
commit 070fe12e25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -310,8 +310,10 @@ export function number(val) {
if (val > 999999) {
formattedNumber = I18n.toNumber(val / 1000000, {precision: 1});
return I18n.t("number.short.millions", {number: formattedNumber});
}
if (val > 999) {
} else if (val > 99999) {
formattedNumber = I18n.toNumber(val / 1000, {precision: 0});
return I18n.t("number.short.thousands", {number: formattedNumber});
} else if (val > 999) {
formattedNumber = I18n.toNumber(val / 1000, {precision: 1});
return I18n.t("number.short.thousands", {number: formattedNumber});
}