1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 11:57:36 +00:00

LibJS: Add yearOfWeek calendar methods and properties

This is a normative change in the Temporal spec.

See:
- 7fa4d18
- caa941d
This commit is contained in:
Luke Wilde 2022-12-26 00:58:43 +00:00 committed by Andreas Kling
parent 804baa42f9
commit fa1416987a
15 changed files with 294 additions and 126 deletions

View file

@ -0,0 +1,15 @@
describe("correct behavior", () => {
test("basic functionality", () => {
const timeZone = new Temporal.TimeZone("UTC");
const zonedDateTime = new Temporal.ZonedDateTime(1672531200000000000n, timeZone);
expect(zonedDateTime.yearOfWeek).toBe(2022);
});
});
describe("errors", () => {
test("this value must be a Temporal.ZonedDateTime object", () => {
expect(() => {
Reflect.get(Temporal.ZonedDateTime.prototype, "yearOfWeek", "foo");
}).toThrowWithMessage(TypeError, "Not an object of type Temporal.ZonedDateTime");
});
});