Skip to content

Fix setUTCMonth check off by one #2239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 9, 2022
Merged

Fix setUTCMonth check off by one #2239

merged 2 commits into from
Apr 9, 2022

Conversation

dcodeIO
Copy link
Member

@dcodeIO dcodeIO commented Mar 25, 2022

Fixes #2229 and related tests. Not sure what exactly is being tested with these huge timestamps (year 252309), though, so I'm not particularly confident regarding the assertion changes :) @ColinEberhardt, any idea?

  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file

@dcodeIO dcodeIO mentioned this pull request Mar 27, 2022
2 tasks
@ColinEberhardt
Copy link
Contributor

@ColinEberhardt, any idea?

Hmmm ... good question, it looks like these values are quite close to the largest Date that JavaScript is able to represent, but not quite at the boundary. Not much help I'm afraid!

@dcodeIO
Copy link
Member Author

dcodeIO commented Mar 28, 2022

Thanks :) TIL

It should be noted that the maximum Date is not of the same value as the maximum safe integer (Number.MAX_SAFE_INTEGER is 9,007,199,254,740,991). Instead, it is defined in ECMA-262 that a maximum of ±100,000,000 (one hundred million) days relative to January 1, 1970 UTC (that is, April 20, 271821 BCE ~ September 13, 275760 CE) can be represented by the standard Date object (equivalent to ±8,640,000,000,000,000 milliseconds).

Makes me assume that it's implicitly making sure that huge dates work.

@dcodeIO dcodeIO merged commit 2b7ad4d into main Apr 9, 2022
@HerrCai0907 HerrCai0907 deleted the issue-2229 branch October 17, 2023 08:59
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