Skip to content

fix(intl): #5582 — emit timeZoneName part for Temporal.Instant in formatToParts#5774

Merged
proggeramlug merged 1 commit into
mainfrom
fix/5582-dtf-instant-tzname
Jun 28, 2026
Merged

fix(intl): #5582 — emit timeZoneName part for Temporal.Instant in formatToParts#5774
proggeramlug merged 1 commit into
mainfrom
fix/5582-dtf-instant-tzname

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

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:

if crate::temporal::is_temporal_value(value) { return; }

Temporal.Instant is anchored to the timeline, so — like a Date/number — formatToParts should render a zone label for it when timeZoneName is requested. Only the plain Temporal kinds (PlainDate/PlainTime/PlainDateTime/PlainYearMonth/PlainMonthDay) are zoneless and must stay suppressed. (ZonedDateTime/Duration are rejected upstream by date_arg_to_clipped_ms and never reach this path.)

Fix

Suppress only for the plain kinds via temporal_kind, letting an Instant (and the Date/number path) emit the part.

Validation

scripts/test262_subset.py --dir intl402/DateTimeFormat: pass 145, runtime-fail 78 — unchanged from #5770 (the in-scope temporal-*-formatting-timezonename cases use only plain Temporal types, so this is a correctness fix with no test-count delta).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved timeZoneName handling for Temporal values so it now works for Temporal types with an associated time zone.
    • Plain Temporal types without a time zone continue to skip timeZoneName, while other supported date and time inputs still display it when enabled.
    • Updated related behavior notes to match the new formatting rules.

…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>
@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: af695706-e927-4b39-befa-771fcd2ee20f

📥 Commits

Reviewing files that changed from the base of the PR and between 2412d05 and 1a412c6.

📒 Files selected for processing (1)
  • crates/perry-runtime/src/intl/date_collator.rs

📝 Walkthrough

Walkthrough

In append_time_zone_name_part, the early-return guard that previously blocked timeZoneName emission for any Temporal value is replaced with a targeted check using temporal_kind. Only the five "plain" Temporal types (PlainDate, PlainTime, PlainDateTime, PlainYearMonth, PlainMonthDay) now cause an early return; all other Temporal kinds and non-Temporal values proceed normally.

Changes

timeZoneName plain-Temporal guard

Layer / File(s) Summary
Narrow plain-Temporal early-return
crates/perry-runtime/src/intl/date_collator.rs
Replaces is_temporal_value(...) guard with temporal_kind(...) check; returns early only for the five plain Temporal kinds, expanding timeZoneName emission to zone-aware Temporal types and non-Temporal values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Possibly related PRs

  • PerryTS/perry#5770: Both PRs modify date_collator.rs to adjust when timeZoneName parts are emitted for Temporal inputs in formatToParts.

Poem

🐇 Hoppity-hop through the calendar maze,
Plain dates stay quiet, but zoned ones get praise!
No longer rejected for bearing a zone,
The Temporal types with time zones have grown.
I twitched my nose and the guard became wise —
Only the plain ones get early goodbyes! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is specific and accurately summarizes the main change: emitting timeZoneName for Temporal.Instant in formatToParts.
Description check ✅ Passed The description covers the problem, fix, related issue, and validation; it is mostly complete despite not following every template subsection.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/5582-dtf-instant-tzname

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proggeramlug proggeramlug merged commit 90dcaab into main Jun 28, 2026
15 checks passed
@proggeramlug proggeramlug deleted the fix/5582-dtf-instant-tzname branch June 28, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant