-
-
Notifications
You must be signed in to change notification settings - Fork 481
Implement Intl.DateTimeFormat
#4378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Test262 conformance changes
Fixed tests (36): |
8afb6f2 to
8ba79c2
Compare
184ebc7 to
efbdc22
Compare
efbdc22 to
f8f9171
Compare
|
This is ready for review. Just to note, this is primarily just the EDIT: It also does not currently support Temporal. So that will need to be added in follow ups as well. |
sffc
left a comment
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
hansl
left a comment
There was a problem hiding this 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.
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 😄