mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:57: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
|
@ -38,7 +38,7 @@ describe("correct behavior", () => {
|
|||
});
|
||||
|
||||
test("PlainTime string argument", () => {
|
||||
const createdPlainTime = Temporal.PlainTime.from("2021-08-27T18:44:11Z");
|
||||
const createdPlainTime = Temporal.PlainTime.from("2021-08-27T18:44:11");
|
||||
expect(createdPlainTime.hour).toBe(18);
|
||||
expect(createdPlainTime.minute).toBe(44);
|
||||
expect(createdPlainTime.second).toBe(11);
|
||||
|
@ -55,4 +55,13 @@ describe("errors", () => {
|
|||
Temporal.PlainTime.from(zonedDateTime);
|
||||
}).toThrowWithMessage(TypeError, "null is not a function");
|
||||
});
|
||||
|
||||
test("string must not contain a UTC designator", () => {
|
||||
expect(() => {
|
||||
Temporal.PlainTime.from("2021-07-06T23:42:01Z");
|
||||
}).toThrowWithMessage(
|
||||
RangeError,
|
||||
"Invalid time string '2021-07-06T23:42:01Z': must not contain a UTC designator"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue