Skip to content

Fix serialization of Dates with expanded ISO years - #232

Open
Shubham-Padkonde wants to merge 1 commit into
yahoo:mainfrom
Shubham-Padkonde:fix/expanded-date-years
Open

Shubham-Padkonde wants to merge 1 commit into
yahoo:mainfrom
Shubham-Padkonde:fix/expanded-date-years

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown

Valid JavaScript Dates outside years 0000–9999 currently throw Invalid Date ISO string during serialization: toISOString() returns a signed six-digit year, but the safety validation accepts only four-digit years.

Accept the expanded-year format while retaining the anchored numeric date/time validation. Tests round-trip year -1, year 10000, and both ends of JavaScript's supported Date range. All four regressions fail before the fix; all 104 tests pass afterward, including the existing injection checks. git diff --check passes.

The expanded format is specified in https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-date-time-string-format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant