Bug 195974 - Intl.DateTimeFormat should obey 2-digit hour
Summary: Intl.DateTimeFormat should obey 2-digit hour
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Safari 12
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andy VanWagoner
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-03-19 16:09 PDT by Shane Carr
Modified: 2019-03-26 12:18 PDT (History)
11 users (show)

See Also:


Attachments
Patch (4.99 KB, patch)
2019-03-25 17:12 PDT, Andy VanWagoner
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews100 for mac-highsierra (2.74 MB, application/zip)
2019-03-25 17:53 PDT, EWS Watchlist
no flags Details
Patch (7.27 KB, patch)
2019-03-25 18:30 PDT, Andy VanWagoner
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Shane Carr 2019-03-19 16:09:38 PDT
The following code has unexpected results.

new Intl.DateTimeFormat('ru', {hour:'2-digit', minute: '2-digit', hour12: false}).format(new Date(2015, 8, 1, 3, 0, 0))
new Intl.DateTimeFormat('ru', {hour:'2-digit', minute: '2-digit', hour12: true}).format(new Date(2015, 8, 1, 3, 0, 0))

The expected output is:

03:00
03:00 AM (or a Cyrillic alternative to "AM")

Safari leaves off the leading 0 digit.

Screenshot:

https://user-images.githubusercontent.com/1235286/54647595-1e093780-4ab4-11e9-971d-a12c32b41e18.png

The bug was reported in ECMA 402:

https://github.com/tc39/ecma402/issues/283

Chrome and Firefox had similar issues which are being tracked.  Chrome has a fix ready to merge.

https://bugs.chromium.org/p/chromium/issues/detail?id=527926
https://bugzilla.mozilla.org/show_bug.cgi?id=1284868
Comment 1 Radar WebKit Bug Importer 2019-03-21 20:18:18 PDT
<rdar://problem/49137227>
Comment 2 Andy VanWagoner 2019-03-25 17:12:51 PDT
Created attachment 365923 [details]
Patch
Comment 3 EWS Watchlist 2019-03-25 17:53:16 PDT
Comment on attachment 365923 [details]
Patch

Attachment 365923 [details] did not pass mac-ews (mac):
Output: https://webkit-queues.webkit.org/results/11666408

New failing tests:
js/intl-datetimeformat.html
Comment 4 EWS Watchlist 2019-03-25 17:53:17 PDT
Created attachment 365929 [details]
Archive of layout-test-results from ews100 for mac-highsierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews100  Port: mac-highsierra  Platform: Mac OS X 10.13.6
Comment 5 Andy VanWagoner 2019-03-25 18:30:45 PDT
Created attachment 365935 [details]
Patch
Comment 6 Keith Miller 2019-03-26 12:08:05 PDT
Comment on attachment 365935 [details]
Patch

r=me.
Comment 7 WebKit Commit Bot 2019-03-26 12:18:52 PDT
Comment on attachment 365935 [details]
Patch

Clearing flags on attachment: 365935

Committed r243512: <https://trac.webkit.org/changeset/243512>
Comment 8 WebKit Commit Bot 2019-03-26 12:18:54 PDT
All reviewed patches have been landed.  Closing bug.