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

LibJS: Reject relativeTo string such as "2022-08-18T17:01Z"

This is a normative change in the Temporal spec.

See: 2dc20bf
This commit is contained in:
Linus Groh 2022-10-17 09:20:38 +02:00
parent 57162ad510
commit 4567ded8e4
5 changed files with 22 additions and 2 deletions

View file

@ -100,4 +100,14 @@ describe("errors", () => {
Temporal.Duration.compare(duration, duration, { relativeTo: zonedDateTime });
}).toThrowWithMessage(TypeError, "null is not a function");
});
test("UTC designator only allowed with bracketed time zone", () => {
const duration = new Temporal.Duration();
expect(() => {
Temporal.Duration.compare(duration, duration, { relativeTo: "2022-08-18T17:01Z" });
}).toThrowWithMessage(
RangeError,
"Invalid relativeTo string '2022-08-18T17:01Z': must not contain a UTC designator without bracketed time zone"
);
});
});