1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:47:45 +00:00

LibJS: Change default time display options to "always" for digital style

This is a normative change in the Intl.DurationFormat proposal. See:
d28076b
This commit is contained in:
Timothy Flynn 2022-09-22 08:58:13 -04:00 committed by Linus Groh
parent 5f4c59e2c1
commit 82e730eba1
2 changed files with 48 additions and 13 deletions

View file

@ -62,6 +62,32 @@ describe("correct behavior", () => {
}).format(duration)
).toBe("1 J, 2 M, 3 W, 3 T, 4 Std., 5 Min., 6 Sek., 7 ms und 8,009 μs");
});
test("always show time fields for digital style", () => {
const duration1 = {
years: 1,
months: 2,
weeks: 3,
days: 3,
};
const duration2 = {
years: 1,
months: 2,
weeks: 3,
days: 3,
hours: 4,
minutes: 5,
seconds: 6,
};
const en = new Intl.DurationFormat("en", { style: "digital" });
expect(en.format(duration1)).toBe("1 yr 2 mths 3 wks 3 days 0:00:00");
expect(en.format(duration2)).toBe("1 yr 2 mths 3 wks 3 days 4:05:06");
const de = new Intl.DurationFormat("de", { style: "digital" });
expect(de.format(duration1)).toBe("1 J, 2 Mon., 3 Wo., 3 Tg. und 0:00:00");
expect(de.format(duration2)).toBe("1 J, 2 Mon., 3 Wo., 3 Tg. und 4:05:06");
});
});
describe("errors", () => {