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

LibJS: Align ISO 8601 grammar with annotations from IXDTF

This is a normative change in the Temporal spec.

See: c64b844
This commit is contained in:
Luke Wilde 2022-11-02 18:26:46 +00:00 committed by Linus Groh
parent 0f2b4d0aac
commit 192aa75279
6 changed files with 245 additions and 93 deletions

View file

@ -65,12 +65,12 @@ describe("errors", () => {
);
});
test("calendar annotation must match calendar grammar even though it's ignored", () => {
test("annotations must match annotation grammar even though they're ignored", () => {
expect(() => {
Temporal.Instant.from("1970-01-01T00:00Z[u-ca=SerenityOS]");
Temporal.Instant.from("1970-01-01T00:00Z[SerenityOS=cool]");
}).toThrowWithMessage(
RangeError,
"Invalid instant string '1970-01-01T00:00Z[u-ca=SerenityOS]'"
"Invalid instant string '1970-01-01T00:00Z[SerenityOS=cool]'"
);
});
});

View file

@ -31,11 +31,11 @@ describe("errors", () => {
}).toThrowWithMessage(TypeError, "Not an object of type Temporal.ZonedDateTime");
});
test("from invalid calendar string", () => {
test("from invalid calendar identifier", () => {
const zonedDateTime = new Temporal.ZonedDateTime(1n, {}, {});
expect(() => {
zonedDateTime.withCalendar("iso8602foobar");
}).toThrowWithMessage(RangeError, "Invalid calendar string 'iso8602foobar'");
}).toThrowWithMessage(RangeError, "Invalid calendar identifier 'iso8602foobar'");
});
});