Bug 195974

Summary: Intl.DateTimeFormat should obey 2-digit hour
Product: WebKit Reporter: Shane Carr <sffc>
Component: JavaScriptCoreAssignee: Andy VanWagoner <andy>
Status: RESOLVED FIXED    
Severity: Normal CC: andy, ap, commit-queue, ews-watchlist, keith_miller, mark.lam, mmaxfield, msaboff, rniwa, saam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 12   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews100 for mac-highsierra
none
Patch none

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.