Skip to content

fix(intl): apply locale and timezone data - #8997

Merged
proggeramlug merged 2 commits into
PerryTS:mainfrom
proggeramlug:fix/8903-intl-fallback
Aug 29, 2026
Merged

fix(intl): apply locale and timezone data#8997
proggeramlug merged 2 commits into
PerryTS:mainfrom
proggeramlug:fix/8903-intl-fallback

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #8903

Summary

  • resolve and validate named DateTimeFormat zones with the compiled IANA database, including DST
  • route weekday-only component formats through the correct ICU date fieldset
  • retain Unicode normalization in auto-optimized Collator builds
  • add a Node-parity regression covering de-DE date, weekday, Berlin time, and collation

Testing

Run on root@perrymaster.skelpo.net:

  • cargo test --release -p perry-runtime name_bearing_components_match_node -- --nocapture
  • cargo test --release -p perry-runtime compiled_tzdb_resolves_named_zone_and_dst -- --nocapture
  • cargo test --release -p perry string_normalization_gate_covers_normalize_and_locale_compare -- --nocapture
  • compiled and ran test_gap_issue_8903_intl_locale_data.ts with Node 26.8.1, full PERRY_NO_AUTO_OPTIMIZE=1, and auto-optimized Perry; all outputs were byte-identical

No version bump.

Summary by CodeRabbit

  • Bug Fixes

    • Intl.DateTimeFormat now supports named IANA time zones with accurate daylight-saving transitions.
    • Weekday-only date formats now use the requested locale’s language data.
    • Intl.Collator preserves locale-aware comparison and Unicode normalization in optimized builds.
    • Regular expression behavior is preserved for application-created expressions in compiled packages.
  • Performance

    • Array subclass push() operations can use a faster inline path when applicable.
  • Tests

    • Added coverage for German localization, Berlin time-zone formatting, daylight saving, and collation behavior.

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8e3b8d52-e0e9-49aa-b59a-e46e8e4f55a1

📥 Commits

Reviewing files that changed from the base of the PR and between d4ec70c and 5bc2ef4.

📒 Files selected for processing (12)
  • changelog.d/8995-compiled-package-regexp.md
  • changelog.d/8996-elements-inline-push.md
  • changelog.d/8997-intl-locale-timezone.md
  • crates/perry-runtime/Cargo.toml
  • crates/perry-runtime/src/date.rs
  • crates/perry-runtime/src/intl.rs
  • crates/perry-runtime/src/intl/date_collator.rs
  • crates/perry-runtime/src/intl/icu_dtf.rs
  • crates/perry-runtime/src/intl/time_zone.rs
  • crates/perry/src/commands/compile/collect_modules/feature_detect.rs
  • crates/perry/src/commands/compile/types.rs
  • test-files/test_gap_issue_8903_intl_locale_data.ts

📝 Walkthrough

Walkthrough

The runtime adds compiled IANA timezone resolution, localized weekday formatting, and separate date/time formatter paths. Compiler detection enables normalization data for Intl.Collator. Changelog entries document these fixes and two additional compiled-runtime changes.

Changes

Intl locale and timezone behavior

Layer / File(s) Summary
Compiled timezone resolution
crates/perry-runtime/Cargo.toml, crates/perry-runtime/src/date.rs, crates/perry-runtime/src/intl/time_zone.rs, crates/perry-runtime/src/intl.rs
The runtime adds a compiled IANA database provider, canonicalizes named zones, and computes DST-aware offsets. Minimal builds retain structural timezone validation.
Localized DateTimeFormat field formatting
crates/perry-runtime/src/intl/icu_dtf.rs, crates/perry-runtime/src/intl/date_collator.rs, test-files/test_gap_issue_8903_intl_locale_data.ts, changelog.d/8997-intl-locale-timezone.md
DateTimeFormat selects separate date, time, or combined formatters. Weekday-only requests use localized ICU data. Regression coverage verifies German locale, Berlin timezone, weekday, and collation output.
Collator normalization feature detection
crates/perry/src/commands/compile/collect_modules/feature_detect.rs, crates/perry/src/commands/compile/types.rs
Intl.Collator now enables the string-normalization feature gate. Comments and tests describe and verify the additional trigger.

Additional release notes

Layer / File(s) Summary
Compiled runtime changelog entries
changelog.d/8995-compiled-package-regexp.md, changelog.d/8996-elements-inline-push.md
The changelog documents preserved RegExp behavior in compiled packages and inline push handling for Array subclasses.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Application
  participant IntlDateTimeFormat
  participant TimeZoneResolver
  participant CompiledTzdb
  participant ICUFormatter
  Application->>IntlDateTimeFormat: format date with locale and named timeZone
  IntlDateTimeFormat->>TimeZoneResolver: canonicalize named timezone
  TimeZoneResolver->>CompiledTzdb: resolve zone and instant offset
  CompiledTzdb-->>TimeZoneResolver: canonical zone and DST-aware offset
  IntlDateTimeFormat->>ICUFormatter: format selected date/time fields
  ICUFormatter-->>IntlDateTimeFormat: localized output
  IntlDateTimeFormat-->>Application: formatted string
Loading

Suggested reviewers: thehypnoo

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Copy link
Copy Markdown
Contributor Author

Merged (batched with #8995 and #8996).

I checked the timezone work behaviourally rather than trusting the unit tests, since "resolve named zones from the compiled IANA database, including DST" is the sort of claim that passes a fixed-offset implementation right up until it does not:

America/New_York, 2026-07-15T12:00Z   perry=08:00   node=08:00
Asia/Tokyo,       2026-07-15T12:00Z   perry=21:00   node=21:00

08:00 is the one that matters — that is EDT, so the offset is genuinely coming from DST rules rather than a stored standard offset, which a July date would otherwise render as 07:00.

One fix pushed: the fragment was named 8903-intl-locale-timezone.md. #8903 is the issue this fixes, not the PR, so the change would have been filed under an issue number at release time. Renamed to 8997-.

Validation — runtime 2787/0, codegen 1341/0, stdlib 124/0 (RUST_TEST_THREADS=1); scripts/run_lint_gates.sh 57 of 58 with the compile tier green — the exception is the pre-existing Actions-expression artifact (#8929).

@proggeramlug
proggeramlug merged commit 94947ae into PerryTS:main Aug 29, 2026
18 of 19 checks passed
@proggeramlug
proggeramlug deleted the fix/8903-intl-fallback branch August 29, 2026 05:47
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.

Intl.DateTimeFormat and Intl.Collator silently fall back to en-US/root while resolvedOptions() reports de-DE; timeZone is ignored

1 participant