Skip to content

Do not overly range check when constructing Temporal PlainMonthDay#695

Merged
nekevss merged 1 commit intoboa-dev:mainfrom
Manishearth:monthday-range
Mar 19, 2026
Merged

Do not overly range check when constructing Temporal PlainMonthDay#695
nekevss merged 1 commit intoboa-dev:mainfrom
Manishearth:monthday-range

Conversation

@Manishearth
Copy link
Contributor

@Manishearth Manishearth commented Mar 17, 2026

Fixes #688

This works, but looks kind of gnarly because of #695.

@nekevss nekevss merged commit f7ae910 into boa-dev:main Mar 19, 2026
8 checks passed
@Manishearth Manishearth deleted the monthday-range branch March 19, 2026 16:45
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect range check in Calendar::month_day_from_fields

3 participants