LibJS: Implement Temporal.ZonedDateTime.prototype.toPlainYearMonth()

This commit is contained in:
Linus Groh 2021-08-23 23:35:59 +01:00 committed by Andreas Kling
commit ef581be4ec
Notes: sideshowbarker 2024-07-18 05:20:13 +09:00
3 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,14 @@
describe("correct behavior", () => {
test("length is 0", () => {
expect(Temporal.ZonedDateTime.prototype.toPlainYearMonth).toHaveLength(0);
});
test("basic functionality", () => {
const timeZone = new Temporal.TimeZone("UTC");
const zonedDateTime = new Temporal.ZonedDateTime(1625614921000000000n, timeZone);
const plainYearMonth = zonedDateTime.toPlainYearMonth();
expect(plainYearMonth.calendar).toBe(zonedDateTime.calendar);
expect(plainYearMonth.year).toBe(2021);
expect(plainYearMonth.month).toBe(7);
});
});