UX: for numbers greater than 100k allow 0 precision

This commit is contained in:
Arpit Jalan 2018-01-02 13:27:46 +05:30
parent 222fab1435
commit 04b8831cde
1 changed files with 4 additions and 2 deletions

View File

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