mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:17:44 +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
|
@ -96,7 +96,7 @@ describe("correct behavior", () => {
|
|||
});
|
||||
|
||||
test("PlainDateTime string argument", () => {
|
||||
const plainDateTime = Temporal.PlainDateTime.from("2021-07-06T23:42:01Z");
|
||||
const plainDateTime = Temporal.PlainDateTime.from("2021-07-06T23:42:01");
|
||||
expect(plainDateTime.year).toBe(2021);
|
||||
expect(plainDateTime.month).toBe(7);
|
||||
expect(plainDateTime.day).toBe(6);
|
||||
|
@ -177,4 +177,13 @@ describe("errors", () => {
|
|||
Temporal.PlainDateTime.from(zonedDateTime);
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
});
|
||||
|
||||
test("string must not contain a UTC designator", () => {
|
||||
expect(() => {
|
||||
Temporal.PlainDateTime.from("2021-07-06T23:42:01Z");
|
||||
}).toThrowWithMessage(
|
||||
RangeError,
|
||||
"Invalid date time string '2021-07-06T23:42:01Z': must not contain a UTC designator"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue