Skip to content

Fix serialization of Dates with expanded ISO years - #232

Merged
redonkulus merged 1 commit into
yahoo:mainfrom
Shubham-Padkonde:fix/expanded-date-years
Oct 22, 2026
Merged

redonkulus merged 1 commit into
yahoo:mainfrom
Shubham-Padkonde:fix/expanded-date-years

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown
Contributor

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.

@redonkulus
redonkulus merged commit e978a1b into yahoo:main Oct 22, 2026
4 checks passed
@redonkulus

Copy link
Copy Markdown
Collaborator

Thank you for contributing!

@redonkulus redonkulus mentioned this pull request Oct 22, 2026
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.

2 participants