1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:57:47 +00:00

LibJS: Adjust ISO8601 representation for years between 1 BCE and 999 CE

This is a normative change in the Temporal spec.

See: 39eeecd
This commit is contained in:
Linus Groh 2022-03-31 00:54:27 +01:00
parent cfb04765fa
commit 8e175b4959
3 changed files with 17 additions and 10 deletions

View file

@ -19,10 +19,13 @@ describe("correct behavior", () => {
expect(plainDate.toString({ calendarName: "never" })).toBe("2021-07-06");
plainDate = new Temporal.PlainDate(0, 1, 1);
expect(plainDate.toString()).toBe("+000000-01-01");
expect(plainDate.toString()).toBe("0000-01-01");
plainDate = new Temporal.PlainDate(999, 1, 1);
expect(plainDate.toString()).toBe("+000999-01-01");
expect(plainDate.toString()).toBe("0999-01-01");
plainDate = new Temporal.PlainDate(9999, 1, 1);
expect(plainDate.toString()).toBe("9999-01-01");
plainDate = new Temporal.PlainDate(12345, 1, 1);
expect(plainDate.toString()).toBe("+012345-01-01");

View file

@ -21,10 +21,13 @@ describe("correct behavior", () => {
expect(plainYearMonth.toString({ calendarName: "never" })).toBe("2021-07-06");
plainYearMonth = new Temporal.PlainYearMonth(0, 1);
expect(plainYearMonth.toString()).toBe("+000000-01");
expect(plainYearMonth.toString()).toBe("0000-01");
plainYearMonth = new Temporal.PlainYearMonth(999, 1);
expect(plainYearMonth.toString()).toBe("+000999-01");
expect(plainYearMonth.toString()).toBe("0999-01");
plainYearMonth = new Temporal.PlainYearMonth(9999, 1);
expect(plainYearMonth.toString()).toBe("9999-01");
plainYearMonth = new Temporal.PlainYearMonth(12345, 1);
expect(plainYearMonth.toString()).toBe("+012345-01");