mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 16:52:45 +08:00
FIX: makes sure [999500..999999] is correctly shown as 999k
This commit is contained in:
parent
642c60c310
commit
6d4ff05cf0
|
@ -311,7 +311,7 @@ export function number(val) {
|
|||
formattedNumber = I18n.toNumber(val / 1000000, {precision: 1});
|
||||
return I18n.t("number.short.millions", {number: formattedNumber});
|
||||
} else if (val > 99999) {
|
||||
formattedNumber = I18n.toNumber(val / 1000, {precision: 0});
|
||||
formattedNumber = I18n.toNumber(Math.floor(val / 1000), {precision: 0});
|
||||
return I18n.t("number.short.thousands", {number: formattedNumber});
|
||||
} else if (val > 999) {
|
||||
formattedNumber = I18n.toNumber(val / 1000, {precision: 1});
|
||||
|
|
|
@ -211,6 +211,8 @@ QUnit.test("number", assert => {
|
|||
assert.equal(number(NaN), "0", "it returns 0 for NaN");
|
||||
assert.equal(number(3333), "3.3k", "it abbreviates thousands");
|
||||
assert.equal(number(2499999), "2.5M", "it abbreviates millions");
|
||||
assert.equal(number(1000000), "1.0M", "it abbreviates a million");
|
||||
assert.equal(number(999999), "999k", "it abbreviates hundreds of thousands");
|
||||
});
|
||||
|
||||
QUnit.test("durationTiny", assert => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user