mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 00:27:43 +00:00
LibJS: Make parse_simplified_iso8601() use Optional<int> instead of -1
...for the non-success state. This fixes a crash when parsing dates with the year -1, as we would assert successful parsing ("year != -1"). Mixing Optional and -1 seems worse and more complicated than just using Optional for all the values, so I did that instead.
This commit is contained in:
parent
39cdffd78d
commit
a647f0abf6
2 changed files with 36 additions and 29 deletions
|
@ -10,6 +10,7 @@ test("basic functionality", () => {
|
|||
expect(Date.parse("2020T23:59Z")).toBe(1577923140000);
|
||||
|
||||
expect(Date.parse("+020000")).toBe(568971820800000);
|
||||
expect(Date.parse("-000001")).toBe(-62198755200000);
|
||||
expect(Date.parse("+020000-01")).toBe(568971820800000);
|
||||
expect(Date.parse("+020000-01T00:00:00.000Z")).toBe(568971820800000);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue