Conversation
…nDateTime/ZonedDateTime/PlainMonthDay field bags
The PlainDateTime / ZonedDateTime property-bag reader (`read_iso_fields_alpha`,
`read_zoned_bag_alpha`) and `PlainMonthDay.prototype.toPlainDate`'s year-field
reader never read the `era`/`eraYear` keys. For a calendar that uses eras
(gregory, japanese, roc, buddhist, coptic, ethiopic/ethioaa, the islamic
family, hebrew, indian, persian) an `{ era, eraYear, monthCode, day }` bag
therefore reached temporal_rs/ICU4X with no resolvable year and threw
`Insufficient fields` (the dominant intl402/Temporal failure cluster), and a
`with({ era, eraYear })` likewise dropped the era keys. They are now read in
their alphabetical position (right after `day`, before `hour`) for era-using
calendars only, so era-relative dates resolve and a non-finite `eraYear`
rejects with the spec `RangeError`.
Era-less calendars — `iso8601`, `chinese`, `dangi` — still skip the keys
(new `calendar_has_no_eras`), so `from({ era, eraYear, year, … })` ignores them
and a `with({ era, eraYear })` bag stays empty → the `EmptyFieldsIsInvalid`
TypeError rather than an `Unknown era` RangeError. ISO order-of-operations is
unchanged (an ISO bag still observes no era/eraYear gets).
intl402/Temporal self-validated test262 sweep (pinned 4249661): 1786→1923 pass
(243→106 fail, 88.0%→94.8%), 137 fixed, 0 regressions. Remaining failures are
the Intl `toLocaleString`/DateTimeFormat formatting clusters (need CLDR data),
out of scope here.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughAdds a ChangesCalendar-aware era/eraYear marshalling
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary
Addresses the dominant clusters of the intl402/Temporal parity tail (#5580). Perry's PlainDateTime / ZonedDateTime property-bag reader (
read_iso_fields_alpha,read_zoned_bag_alpha) andTemporal.PlainMonthDay.prototype.toPlainDate's year-field reader never read theera/eraYearkeys.For a calendar that uses eras, an
{ era, eraYear, monthCode, day }bag therefore reachedtemporal_rs/ICU4X with no resolvable year and threwTypeError: Insufficient fields.— the single biggest reason in the #5580 table (84) — and awith({ era, eraYear })likewise dropped the era keys (thefields cannot be empty/mutually-exclusive-fields-*cluster, 24).What changed
era/eraYearare now read in their alphabetical position (right afterday, beforehour) for era-using calendars in the PlainDateTime/ZonedDateTimefrom+withpaths and inPlainMonthDay.toPlainDate'sYEARfield group. Era-relative dates resolve, and a non-finiteeraYearrejects with the specRangeError(the*-infinity-throws-rangeerrorcases).calendar_has_no_eraskeeps the era-less calendars (iso8601,chinese,dangi) skipping those keys, sofrom({ era, eraYear, year, … })ignores them and awith({ era, eraYear })bag stays empty → theEmptyFieldsIsInvalidTypeError rather than anUnknown eraRangeError.era/eraYeargets (verified againstbuilt-ins/Temporal/{PlainDateTime,…}/from/order-of-operations.js).Validation
Self-validated test262 sweep,
intl402/Temporal, pinned4249661388e5d3f92a85186213da140a6481490f:137 fixed, 0 regressions. The remaining 106 are the Intl
toLocaleString/DateTimeFormatformatting clusters (default-locale,[object Object],dateStylelong-month, etc.), which need CLDR/ICU formatting data and are out of scope here.🤖 Generated with Claude Code
Summary by CodeRabbit
Temporalfield handling so calendar-specific values are read more reliably.withandtoPlainDatenow respect the object’s calendar when deriving date fields.ZonedDateTime.withnow preserves calendar context when applying field updates.