Skip to content

spec: valid year range in NonISOMonthDayToISOReferenceDate #125

@fabon-f

Description

@fabon-f

NonISOMonthDayToISOReferenceDate has a step to validate whether fields.[[Year]] isn't too small or large:

i. If there exists no combination of inputs such that ! CalendarIntegersToISO(calendar, fields.[[Year]], ..., ...) would return an ISO Date Record isoDate for which ISODateWithinLimits(isoDate) is true, throw a RangeError exception.

My understanding is that Temporal.PlainMonthDay.from({ year: 275760, month: 12, day: 31, calendar: 'gregory' }) shouldn't fail since the maximum date belongs to the year 275760, but Temporal.PlainMonthDay.from({ year: 275761, month: 1, day: 1, calendar: 'gregory' }) should fail, according to the spec (the same thing would be applied for the lower bound and other calendars).

In reality, while SpiderMonkey and V8 raise an out-of-bound error for both cases, the reference polyfill accepts both. Also this discrepancy doesn't seem to be covered in test262.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions