mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:57: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:
parent
836ce8ee5d
commit
78724fdd33
6 changed files with 87 additions and 16 deletions
|
@ -63,7 +63,7 @@ describe("correct behavior", () => {
|
|||
});
|
||||
|
||||
test("from date time string", () => {
|
||||
const plainYearMonth = Temporal.PlainYearMonth.from("2021-07-06T23:42:01Z");
|
||||
const plainYearMonth = Temporal.PlainYearMonth.from("2021-07-06T23:42:01");
|
||||
expect(plainYearMonth.year).toBe(2021);
|
||||
expect(plainYearMonth.month).toBe(7);
|
||||
expect(plainYearMonth.monthCode).toBe("M07");
|
||||
|
@ -92,4 +92,13 @@ describe("errors", () => {
|
|||
Temporal.PlainYearMonth.from("foo");
|
||||
}).toThrowWithMessage(RangeError, "Invalid year month string 'foo'");
|
||||
});
|
||||
|
||||
test("string must not contain a UTC designator", () => {
|
||||
expect(() => {
|
||||
Temporal.PlainYearMonth.from("2021-07-06T23:42:01Z");
|
||||
}).toThrowWithMessage(
|
||||
RangeError,
|
||||
"Invalid year month string '2021-07-06T23:42:01Z': must not contain a UTC designator"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue