Bug 231041 - [JSC] DateTimeFormat.resolvedOptions shouldn't return an object with other date/time properties if dateStyle or timeStyle are set
Summary: [JSC] DateTimeFormat.resolvedOptions shouldn't return an object with other da...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-09-30 15:57 PDT by Philip Chimento
Modified: 2021-10-02 19:13 PDT (History)
12 users (show)

See Also:


Attachments
Patch (7.80 KB, patch)
2021-10-02 14:51 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philip Chimento 2021-09-30 15:57:13 PDT
According to the specification for Intl.DateTimeFormat.prototype.resolvedOptions() (https://tc39.es/ecma402/#sec-intl.datetimeformat.prototype.resolvedoptions) step 5.d, none of the properties in Table 4 (weekday, era, year, month, day, dayPeriod, hour, minute, second, fractionalSecondDigits, timeZoneName) should be present on the returned object if dateStyle or timeStyle are present. JavaScriptCore currently does not implement this step correctly:

> new Intl.DateTimeFormat('en', {dateStyle:'short'}).resolvedOptions().year
"2-digit"

This means you currently cannot always pass the object returned from resolvedOptions() back into the DateTimeFormat constructor as the options argument, for one thing.
Comment 1 Kevin Neal 2021-10-01 14:31:12 PDT
Thank you for filing. The appropriate engineers have been notified.
Comment 2 Radar WebKit Bug Importer 2021-10-01 14:31:27 PDT
<rdar://problem/83782481>
Comment 3 Yusuke Suzuki 2021-10-02 14:51:22 PDT
Created attachment 439973 [details]
Patch
Comment 4 Ross Kirsling 2021-10-02 16:33:21 PDT
Comment on attachment 439973 [details]
Patch

r=me, but we should make sure this gets captured in test262.
Comment 5 EWS 2021-10-02 19:13:26 PDT
Committed r283460 (242439@main): <https://commits.webkit.org/242439@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 439973 [details].