LibJS: Implement stringification Temporal.PlainYearMonth prototypes

This commit is contained in:
Timothy Flynn 2024-11-21 11:39:26 -05:00 committed by Andreas Kling
commit 2da526423f
Notes: github-actions[bot] 2024-11-22 18:56:48 +00:00
8 changed files with 193 additions and 6 deletions

View file

@ -51,10 +51,10 @@ describe("normal behavior", () => {
expect(Object.getPrototypeOf(plainYearMonth)).toBe(Temporal.PlainYearMonth.prototype);
});
// FIXME: Re-implement this test with Temporal.PlainYearMonth.prototype.toString({ calendarName: "always" }).
// test("default reference day is 1", () => {
// const plainYearMonth = new Temporal.PlainYearMonth(2021, 7);
// const fields = plainYearMonth.getISOFields();
// expect(fields.isoDay).toBe(1);
// });
test("default reference day is 1", () => {
const plainYearMonth = new Temporal.PlainYearMonth(2021, 7);
const fields = plainYearMonth.toString({ calendarName: "always" });
const day = fields.split("-")[2].split("[")[0];
expect(day).toBe("01");
});
});