fix(intl): #5582 — emit timeZoneName part for Temporal.Instant in formatToParts#5774
Conversation
…matToParts Follow-up to #5770 (CodeRabbit review). The `timeZoneName`-part guard in `formatToParts` skipped *every* Temporal value, including `Temporal.Instant`. An `Instant` is anchored to the timeline, so — like a `Date`/number — it must render a zone label when `timeZoneName` is requested; only the *plain* Temporal kinds (PlainDate/PlainTime/PlainDateTime/PlainYearMonth/PlainMonthDay) carry no zone and stay suppressed. (`ZonedDateTime`/`Duration` are rejected upstream by `date_arg_to_clipped_ms` and never reach this path.) Behavior-preserving for the test262 intl402/DateTimeFormat suite (pass 145, runtime-fail 78, unchanged); the in-scope timezonename cases use only plain Temporal types. 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 (1)
📝 WalkthroughWalkthroughIn ChangestimeZoneName plain-Temporal guard
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Follow-up to #5770 addressing a CodeRabbit review comment that arrived after that PR merged.
Problem
The
timeZoneName-part guard added in #5770 (append_time_zone_name_part) skipped every Temporal value:Temporal.Instantis anchored to the timeline, so — like aDate/number —formatToPartsshould render a zone label for it whentimeZoneNameis requested. Only the plain Temporal kinds (PlainDate/PlainTime/PlainDateTime/PlainYearMonth/PlainMonthDay) are zoneless and must stay suppressed. (ZonedDateTime/Durationare rejected upstream bydate_arg_to_clipped_msand never reach this path.)Fix
Suppress only for the plain kinds via
temporal_kind, letting anInstant(and theDate/number path) emit the part.Validation
scripts/test262_subset.py --dir intl402/DateTimeFormat: pass 145, runtime-fail 78 — unchanged from #5770 (the in-scopetemporal-*-formatting-timezonenamecases use only plain Temporal types, so this is a correctness fix with no test-count delta).🤖 Generated with Claude Code
Summary by CodeRabbit
timeZoneNamehandling for Temporal values so it now works for Temporal types with an associated time zone.timeZoneName, while other supported date and time inputs still display it when enabled.