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

LibJS: Use TimeZoneMethods in GetOffsetNanosecondsFor

Update to the latest version of the spec which was refactored to use
time zone methods record. This requires updating a whole bunch of
callers to pass through a record too.

This also ends up improving exceptions on a missing
getOffsetNanosecondsFor method.
This commit is contained in:
Shannon Booth 2024-03-02 18:30:08 +13:00 committed by Andreas Kling
parent 230ffc022c
commit f95117f75d
22 changed files with 52 additions and 39 deletions

View file

@ -51,6 +51,6 @@ describe("errors", () => {
const zonedDateTime = new Temporal.ZonedDateTime(0n, {});
expect(() => {
zonedDateTime.getISOFields();
}).toThrowWithMessage(TypeError, "null is not a function");
}).toThrowWithMessage(TypeError, "getOffsetNanosecondsFor is undefined");
});
});

View file

@ -23,6 +23,6 @@ describe("errors", () => {
const zonedDateTime = new Temporal.ZonedDateTime(0n, {});
expect(() => {
zonedDateTime.offset;
}).toThrowWithMessage(TypeError, "null is not a function");
}).toThrowWithMessage(TypeError, "getOffsetNanosecondsFor is undefined");
});
});

View file

@ -23,6 +23,6 @@ describe("errors", () => {
const zonedDateTime = new Temporal.ZonedDateTime(0n, {});
expect(() => {
zonedDateTime.offsetNanoseconds;
}).toThrowWithMessage(TypeError, "null is not a function");
}).toThrowWithMessage(TypeError, "getOffsetNanosecondsFor is undefined");
});
});

View file

@ -22,6 +22,6 @@ describe("errors", () => {
const zonedDateTime = new Temporal.ZonedDateTime(0n, {});
expect(() => {
zonedDateTime.toJSON();
}).toThrowWithMessage(TypeError, "null is not a function");
}).toThrowWithMessage(TypeError, "getOffsetNanosecondsFor is undefined");
});
});

View file

@ -22,6 +22,6 @@ describe("errors", () => {
const zonedDateTime = new Temporal.ZonedDateTime(0n, {});
expect(() => {
zonedDateTime.toLocaleString();
}).toThrowWithMessage(TypeError, "null is not a function");
}).toThrowWithMessage(TypeError, "getOffsetNanosecondsFor is undefined");
});
});

View file

@ -156,7 +156,7 @@ describe("errors", () => {
const zonedDateTime = new Temporal.ZonedDateTime(0n, {});
expect(() => {
zonedDateTime.toString();
}).toThrowWithMessage(TypeError, "null is not a function");
}).toThrowWithMessage(TypeError, "getOffsetNanosecondsFor is undefined");
});
test("calendarName option must be one of 'auto', 'always', 'never', 'critical'", () => {