Skip to content

Conversation

@nekevss
Copy link
Member

@nekevss nekevss commented Aug 15, 2025

Closes #4438

This pull request aims to implement Intl.DateTimeFormat.

Posting as a draft early as I lost my initial work when my laptop died a few weeks back 🙃 So better safe then sorry currently.

There's still plenty of work to be done, but feel free to take a look early 😄

@nekevss nekevss added builtins PRs and Issues related to builtins/intrinsics Intl Changes related to the `Intl` implementation labels Aug 15, 2025
@github-actions
Copy link

github-actions bot commented Aug 15, 2025

Test262 conformance changes

Test result main count PR count difference
Total 52,598 52,598 0
Passed 49,385 49,421 +36
Ignored 2,134 2,134 0
Failed 1,079 1,043 -36
Panics 0 0 0
Conformance 93.89% 93.96% +0.07%
Fixed tests (36):
test/intl402/language-tags-invalid.js (previously Failed)
test/intl402/language-tags-with-underscore.js (previously Failed)
test/intl402/DateTimeFormat/subclassing.js (previously Failed)
test/intl402/DateTimeFormat/constructor-options-dayPeriod-invalid.js (previously Failed)
test/intl402/DateTimeFormat/constructor-options-throwing-getters-dayPeriod.js (previously Failed)
test/intl402/DateTimeFormat/constructor-options-throwing-getters-timedate-style.js (previously Failed)
test/intl402/DateTimeFormat/constructor-options-order-dayPeriod.js (previously Failed)
test/intl402/DateTimeFormat/constructor-options-calendar-invalid.js (previously Failed)
test/intl402/DateTimeFormat/timezone-legacy-non-iana.js (previously Failed)
test/intl402/DateTimeFormat/constructor-invalid-offset-timezone.js (previously Failed)
test/intl402/DateTimeFormat/constructor-options-timeStyle-invalid.js (previously Failed)
test/intl402/DateTimeFormat/constructor-options-throwing-getters-fractionalSecondDigits.js (previously Failed)
test/intl402/DateTimeFormat/constructor-options-numberingSystem-invalid.js (previously Failed)
test/intl402/DateTimeFormat/constructor-options-dateStyle-invalid.js (previously Failed)
test/intl402/DateTimeFormat/constructor-options-fractionalSecondDigits-invalid.js (previously Failed)
test/intl402/DateTimeFormat/constructor-options-timeZoneName-invalid.js (previously Failed)
test/intl402/DateTimeFormat/constructor-options-order-fractionalSecondDigits.js (previously Failed)
test/intl402/DateTimeFormat/timezone-invalid.js (previously Failed)
test/intl402/DateTimeFormat/constructor-calendar-numberingSystem-order.js (previously Failed)
test/intl402/DateTimeFormat/prototype/this-value-not-datetimeformat.js (previously Failed)
test/intl402/DateTimeFormat/prototype/format/related-year-zh.js (previously Failed)
test/intl402/DateTimeFormat/prototype/format/format-function-name.js (previously Failed)
test/intl402/DateTimeFormat/prototype/format/throws-value-non-finite.js (previously Failed)
test/intl402/DateTimeFormat/prototype/format/length.js (previously Failed)
test/intl402/DateTimeFormat/prototype/format/format-function-builtin.js (previously Failed)
test/intl402/DateTimeFormat/prototype/format/taint-Object-prototype.js (previously Failed)
test/intl402/DateTimeFormat/prototype/format/builtin.js (previously Failed)
test/intl402/DateTimeFormat/prototype/format/name.js (previously Failed)
test/intl402/DateTimeFormat/prototype/format/prop-desc.js (previously Failed)
test/intl402/DateTimeFormat/prototype/format/format-function-property-order.js (previously Failed)
test/intl402/DateTimeFormat/prototype/format/date-constructor-not-called.js (previously Failed)
test/intl402/DateTimeFormat/prototype/format/offset-timezone-gmt-same.js (previously Failed)
test/intl402/DateTimeFormat/prototype/format/format-function-length.js (previously Failed)
test/intl402/DateTimeFormat/prototype/format/no-instanceof.js (previously Failed)
test/intl402/DateTimeFormat/prototype/format/time-clip-near-time-boundaries.js (previously Failed)
test/intl402/DateTimeFormat/prototype/format/time-clip-to-integer.js (previously Failed)

@nekevss nekevss force-pushed the impl-intl-datetimeformat branch 3 times, most recently from 8afb6f2 to 8ba79c2 Compare November 11, 2025 05:55
@nekevss nekevss force-pushed the impl-intl-datetimeformat branch 3 times, most recently from 184ebc7 to efbdc22 Compare December 9, 2025 14:25
@nekevss nekevss force-pushed the impl-intl-datetimeformat branch from efbdc22 to f8f9171 Compare December 9, 2025 14:45
@nekevss nekevss marked this pull request as ready for review December 9, 2025 14:45
@nekevss nekevss requested a review from a team December 9, 2025 14:45
@nekevss
Copy link
Member Author

nekevss commented Dec 9, 2025

This is ready for review.

Just to note, this is primarily just the format functionality. The rest will need to be added in follow up PRs, but hopefully this keeps the general progress a bit more incremental.

EDIT: It also does not currently support Temporal. So that will need to be added in follow ups as well.

Copy link

@sffc sffc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

//
// See https://tc39.es/ecma402/#sec-intl.datetimeformat-internal-slots

// Handle LDML unicode key "ca", Calendar algorithm
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought: This code is a bit more verbose than I was expecting; locale preferences are supposed to make code like this easier to write. If you have ideas for new functions we could add to icu_locale to make this easier, please suggest.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been pretty standard for resolution on all Intl builtins. There may be a way to make this resolution easier to work through, but ideally this portion of the code would at least live in a potential intermediary crate.

Copy link
Member

@jedel1043 jedel1043 Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is an unfortunate side effect of ECMA402 requiring that all options and extensions must be tested against the data to verify that they're "supported" in some sense, or they should be excluded from the final locale.

I guess we could add on icu_locale a method to do "DataProvider-aware resolution", but it seems better to have that in an ICU4X-ECMA402 crate, since it's a very niche use case.

Copy link
Contributor

@hansl hansl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No notes. Maybe just a test for the parts that aren't supported by ICU4X (like H24). Otherwise LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builtins PRs and Issues related to builtins/intrinsics Intl Changes related to the `Intl` implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Intl: Implement Intl.DateTimeFormat

5 participants