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

LibJS/Temporal: Allow annotations after YYYY-MM and MM-DD

This is a normative change in the Temporal spec.

See: 160e836
This commit is contained in:
Luke Wilde 2023-02-11 01:05:28 +00:00 committed by Linus Groh
parent 421b1eee49
commit 588dae8aa6
8 changed files with 290 additions and 136 deletions

View file

@ -54,4 +54,20 @@ describe("errors", () => {
"Got unexpected TimeZone object in conversion to Calendar"
);
});
test("yyyy-mm and mm-dd strings can only use the iso8601 calendar", () => {
// FIXME: The error message doesn't really indicate this is the case.
const values = [
"02-10[u-ca=iso8602]",
"02-10[u-ca=SerenityOS]",
"2023-02[u-ca=iso8602]",
"2023-02[u-ca=SerenityOS]",
];
for (const value of values) {
expect(() => {
Temporal.Calendar.from(value);
}).toThrowWithMessage(RangeError, `Invalid calendar string '${value}'`);
}
});
});