LibJS: Differentiate between failed ISO8601 parsing and invalid values

If we were able to parse an ISO8601 Date string, but the parse results
in an invalid date (e.g. out of the min/max range), we should abort
parsing immediately.
This commit is contained in:
Timothy Flynn 2024-11-26 11:05:57 -05:00 committed by Tim Flynn
commit fc6155cf2c
Notes: github-actions[bot] 2024-11-26 21:57:31 +00:00
2 changed files with 11 additions and 7 deletions

View file

@ -67,6 +67,12 @@ test("basic functionality", () => {
test("time clip", () => {
expect(Date.parse("+999999")).toBeNaN();
expect(Date.parse("-999999")).toBeNaN();
const belowMinDate = "-271821-04-19T23:59:59.999Z";
expect(belowMinDate).toBeNaN();
const aboveMaxDate = "+275760-09-13T00:00:00.001Z";
expect(aboveMaxDate).toBeNaN();
});
test("extra micro seconds extension", () => {