mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:07:34 +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:
parent
230ffc022c
commit
f95117f75d
22 changed files with 52 additions and 39 deletions
|
@ -67,6 +67,6 @@ describe("errors", () => {
|
|||
const instant = new Temporal.Instant(0n);
|
||||
expect(() => {
|
||||
instant.toString({ timeZone: {} });
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
}).toThrowWithMessage(TypeError, "getOffsetNanosecondsFor is undefined");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -55,6 +55,6 @@ describe("errors", () => {
|
|||
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
|
||||
expect(() => {
|
||||
Temporal.Now.plainDate({}, {});
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
}).toThrowWithMessage(TypeError, "getOffsetNanosecondsFor is undefined");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -52,6 +52,6 @@ describe("errors", () => {
|
|||
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
|
||||
expect(() => {
|
||||
Temporal.Now.plainDateISO({});
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
}).toThrowWithMessage(TypeError, "getOffsetNanosecondsFor is undefined");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -104,6 +104,6 @@ describe("errors", () => {
|
|||
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
|
||||
expect(() => {
|
||||
Temporal.Now.plainDateTime({}, {});
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
}).toThrowWithMessage(TypeError, "getOffsetNanosecondsFor is undefined");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -94,6 +94,6 @@ describe("errors", () => {
|
|||
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
|
||||
expect(() => {
|
||||
Temporal.Now.plainDateTimeISO({});
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
}).toThrowWithMessage(TypeError, "getOffsetNanosecondsFor is undefined");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -39,6 +39,6 @@ describe("errors", () => {
|
|||
test("custom time zone doesn't have a getOffsetNanosecondsFor function", () => {
|
||||
expect(() => {
|
||||
Temporal.Now.plainTimeISO({});
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
}).toThrowWithMessage(TypeError, "getOffsetNanosecondsFor is undefined");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -41,7 +41,7 @@ describe("errors", () => {
|
|||
const zonedDateTime = new Temporal.ZonedDateTime(0n, {});
|
||||
expect(() => {
|
||||
Temporal.PlainDate.from(zonedDateTime);
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
}).toThrowWithMessage(TypeError, "getOffsetNanosecondsFor is undefined");
|
||||
});
|
||||
|
||||
test("invalid date time string", () => {
|
||||
|
|
|
@ -175,7 +175,7 @@ describe("errors", () => {
|
|||
const zonedDateTime = new Temporal.ZonedDateTime(0n, {});
|
||||
expect(() => {
|
||||
Temporal.PlainDateTime.from(zonedDateTime);
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
}).toThrowWithMessage(TypeError, "getOffsetNanosecondsFor is undefined");
|
||||
});
|
||||
|
||||
test("string must not contain a UTC designator", () => {
|
||||
|
|
|
@ -53,7 +53,7 @@ describe("errors", () => {
|
|||
const zonedDateTime = new Temporal.ZonedDateTime(0n, {});
|
||||
expect(() => {
|
||||
Temporal.PlainTime.from(zonedDateTime);
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
}).toThrowWithMessage(TypeError, "getOffsetNanosecondsFor is undefined");
|
||||
});
|
||||
|
||||
test("string must not contain a UTC designator", () => {
|
||||
|
|
|
@ -35,7 +35,7 @@ describe("errors", () => {
|
|||
const instant = new Temporal.Instant(1n);
|
||||
expect(() => {
|
||||
timeZone.getPlainDateTimeFor(instant);
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
}).toThrowWithMessage(TypeError, "getOffsetNanosecondsFor is undefined");
|
||||
});
|
||||
|
||||
test("this value must be a Temporal.TimeZone object", () => {
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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'", () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue