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

LibJS: Don't accept UTC designators in strings for plain Temporal types

This is a normative change in the Temporal spec.

See: cd2dc7d
This commit is contained in:
Linus Groh 2021-11-24 08:56:03 +00:00
parent 836ce8ee5d
commit 78724fdd33
6 changed files with 87 additions and 16 deletions

View file

@ -42,7 +42,7 @@ describe("correct behavior", () => {
});
test("from date time string", () => {
const plainMonthDay = Temporal.PlainMonthDay.from("2021-07-06T23:42:01Z");
const plainMonthDay = Temporal.PlainMonthDay.from("2021-07-06T23:42:01");
expect(plainMonthDay.monthCode).toBe("M07");
expect(plainMonthDay.day).toBe(6);
});
@ -66,4 +66,13 @@ describe("errors", () => {
Temporal.PlainMonthDay.from("foo");
}).toThrowWithMessage(RangeError, "Invalid month day string 'foo'");
});
test("string must not contain a UTC designator", () => {
expect(() => {
Temporal.PlainMonthDay.from("2021-07-06T23:42:01Z");
}).toThrowWithMessage(
RangeError,
"Invalid month day string '2021-07-06T23:42:01Z': must not contain a UTC designator"
);
});
});