-
Notifications
You must be signed in to change notification settings - Fork 733
Improve ICU4C-based Intl.DateTimeFormat implementation #1636
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1484,6 +1484,16 @@ uint8_t getCurrencyDigits(std::u16string_view code) { | |
| // 30. Let dataLocaleData be localeData.[[<dataLocale>]]. | ||
| // 31. Let matcher be ? GetOption(options, "formatMatcher", "string", « | ||
| // "basic", "best fit" », "best fit"). | ||
| // NOTE: Only best fit format matcher is implemented through use of NSDateFormatter. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is unclear to me. "basic" format matcher isn't implemented? Or it's implemented without Platform API? If it's not implemented, where do we early return?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The "basic" format matcher algorithm defined in the spec is not implemented. The Apple implementation uses the Apple Platform API to implement the "best fit" format matcher. And the "best fit" format matcher is used even when "basic" is specified. "best fit" is defined in the spec to be a platform implementation that produces results at least as good as "basic", so it is fine to just always use the "best fit" format matcher. |
||
| // The formatMatcher option is read and checked for valid values. | ||
| auto formatMatcherRes = getOptionString( | ||
| runtime, | ||
| options, | ||
| u"formatMatcher", | ||
| {u"basic", u"best fit"}, | ||
| u"best fit"); | ||
| if (LLVM_UNLIKELY(formatMatcherRes == vm::ExecutionStatus::EXCEPTION)) | ||
| return vm::ExecutionStatus::EXCEPTION; | ||
| // 32. Let dateStyle be ? GetOption(options, "dateStyle", "string", « "full", | ||
| // "long", "medium", "short" », undefined). | ||
| static constexpr std::u16string_view dateStyles[] = { | ||
|
|
||
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.
Update the code comment accordingly.
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.
The existing code comment is correct. The previous code incorrectly missed the "digit" part in the "digit alphanum{3}" check.