Do not overly range check when constructing Temporal PlainMonthDay#695
Merged
nekevss merged 1 commit intoboa-dev:mainfrom Mar 19, 2026
Merged
Do not overly range check when constructing Temporal PlainMonthDay#695nekevss merged 1 commit intoboa-dev:mainfrom
nekevss merged 1 commit intoboa-dev:mainfrom
Conversation
This was referenced Mar 17, 2026
nekevss
approved these changes
Mar 19, 2026
Manishearth
added a commit
that referenced
this pull request
Mar 20, 2026
I only somewhat understand the math here, but opening a PR so @nekevss can look at it. This is really two fixes: - `nudge_calendar_unit` had swapped the math - `UnsignedRoundingMode::apply()` was comparing `dividend` and `divisor` without looking at `r1` and `r2`, which meant it was ignoring the increment. Somehow they were canceling out. We should carefully run test262 on this before landing. I'm not sure if the math here is safe to perform. It's frustrating that the spec handwaves this by speccing something unimplementable ([NudgeToCalendarUnit step 15](https://tc39.es/proposal-temporal/#sec-temporal-nudgetocalendarunit)) and then having a implementation note: this is the second bug today (#695) where I am dealing with bugs arising from spec text that is not directly implementable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #688
This works, but looks kind of gnarly because of #695.