Title: [243512] trunk
Revision
243512
Author
andy@vanwagoner.family
Date
2019-03-26 12:18:46 -0700 (Tue, 26 Mar 2019)

Log Message

Intl.DateTimeFormat should obey 2-digit hour
https://bugs.webkit.org/show_bug.cgi?id=195974

Reviewed by Keith Miller.

Source/_javascript_Core:

* runtime/IntlDateTimeFormat.cpp:
(JSC::IntlDateTimeFormat::initializeDateTimeFormat):

LayoutTests:

* js/intl-datetimeformat-expected.txt:
* js/script-tests/intl-datetimeformat.js:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (243511 => 243512)


--- trunk/LayoutTests/ChangeLog	2019-03-26 19:15:56 UTC (rev 243511)
+++ trunk/LayoutTests/ChangeLog	2019-03-26 19:18:46 UTC (rev 243512)
@@ -1,3 +1,13 @@
+2019-03-26  Andy VanWagoner  <andy@vanwagoner.family>
+
+        Intl.DateTimeFormat should obey 2-digit hour
+        https://bugs.webkit.org/show_bug.cgi?id=195974
+
+        Reviewed by Keith Miller.
+
+        * js/intl-datetimeformat-expected.txt:
+        * js/script-tests/intl-datetimeformat.js:
+
 2019-03-26  Dean Jackson  <d...@apple.com>
 
         vertexAttribPointer must restrict offset parameter

Modified: trunk/LayoutTests/js/intl-datetimeformat-expected.txt (243511 => 243512)


--- trunk/LayoutTests/js/intl-datetimeformat-expected.txt	2019-03-26 19:15:56 UTC (rev 243511)
+++ trunk/LayoutTests/js/intl-datetimeformat-expected.txt	2019-03-26 19:18:46 UTC (rev 243512)
@@ -310,7 +310,7 @@
 PASS Intl.DateTimeFormat('en', { hour: { toString() { throw 'hour' } } }) threw exception hour.
 PASS Intl.DateTimeFormat('en', { hour:[] }) threw exception RangeError: hour must be "2-digit" or "numeric".
 PASS Intl.DateTimeFormat('en').resolvedOptions().hour is undefined
-PASS Intl.DateTimeFormat('en', { minute:'2-digit', hour:'2-digit' }).resolvedOptions().hour is 'numeric'
+PASS Intl.DateTimeFormat('en', { minute:'2-digit', hour:'2-digit' }).resolvedOptions().hour is '2-digit'
 PASS Intl.DateTimeFormat('en', { minute:'2-digit', hour:'2-digit', timeZone: 'UTC' }).format(0) is '12:00 AM'
 PASS Intl.DateTimeFormat('en', { minute:'2-digit', hour:'numeric' }).resolvedOptions().hour is 'numeric'
 PASS Intl.DateTimeFormat('en', { minute:'2-digit', hour:'numeric', timeZone: 'UTC' }).format(0) is '12:00 AM'
@@ -320,7 +320,9 @@
 PASS Intl.DateTimeFormat('en', { minute:'2-digit', hour:'numeric', timeZone: 'UTC' }).format(0) is '12:00 AM'
 PASS Intl.DateTimeFormat('pt-BR', { minute:'2-digit', hour:'numeric' }).resolvedOptions().hourCycle is 'h23'
 PASS Intl.DateTimeFormat('pt-BR', { minute:'2-digit', hour:'numeric' }).resolvedOptions().hour12 is false
-PASS Intl.DateTimeFormat('pt-BR', { minute:'2-digit', hour:'numeric', timeZone: 'UTC' }).format(0) is '00:00'
+PASS Intl.DateTimeFormat('pt-BR', { minute:'2-digit', hour:'numeric', timeZone: 'UTC' }).format(0) is '0:00'
+PASS Intl.DateTimeFormat('ru', { minute:'2-digit', hour:'2-digit', hour12: false, timeZone: 'UTC' }).format(0) is '00:00'
+PASS Intl.DateTimeFormat('ru', { minute:'2-digit', hour:'2-digit', hour12: true, timeZone: 'UTC' }).format(1e7) is '02:46 ДП'
 PASS Intl.DateTimeFormat('en', { minute: { toString() { throw 'minute' } } }) threw exception minute.
 PASS Intl.DateTimeFormat('en', { minute:null }) threw exception RangeError: minute must be "2-digit" or "numeric".
 PASS Intl.DateTimeFormat('en').resolvedOptions().minute is undefined

Modified: trunk/LayoutTests/js/script-tests/intl-datetimeformat.js (243511 => 243512)


--- trunk/LayoutTests/js/script-tests/intl-datetimeformat.js	2019-03-26 19:15:56 UTC (rev 243511)
+++ trunk/LayoutTests/js/script-tests/intl-datetimeformat.js	2019-03-26 19:18:46 UTC (rev 243512)
@@ -423,7 +423,7 @@
 shouldThrow("Intl.DateTimeFormat('en', { hour: { toString() { throw 'hour' } } })", "'hour'");
 shouldThrow("Intl.DateTimeFormat('en', { hour:[] })", '\'RangeError: hour must be "2-digit" or "numeric"\'');
 shouldBe("Intl.DateTimeFormat('en').resolvedOptions().hour", "undefined");
-shouldBe("Intl.DateTimeFormat('en', { minute:'2-digit', hour:'2-digit' }).resolvedOptions().hour", "'numeric'");
+shouldBe("Intl.DateTimeFormat('en', { minute:'2-digit', hour:'2-digit' }).resolvedOptions().hour", "'2-digit'");
 shouldBe("Intl.DateTimeFormat('en', { minute:'2-digit', hour:'2-digit', timeZone: 'UTC' }).format(0)", "'12:00 AM'");
 shouldBe("Intl.DateTimeFormat('en', { minute:'2-digit', hour:'numeric' }).resolvedOptions().hour", "'numeric'");
 shouldBe("Intl.DateTimeFormat('en', { minute:'2-digit', hour:'numeric', timeZone: 'UTC' }).format(0)", "'12:00 AM'");
@@ -434,7 +434,9 @@
 shouldBe("Intl.DateTimeFormat('en', { minute:'2-digit', hour:'numeric', timeZone: 'UTC' }).format(0)", "'12:00 AM'");
 shouldBe("Intl.DateTimeFormat('pt-BR', { minute:'2-digit', hour:'numeric' }).resolvedOptions().hourCycle", "'h23'");
 shouldBe("Intl.DateTimeFormat('pt-BR', { minute:'2-digit', hour:'numeric' }).resolvedOptions().hour12", "false");
-shouldBe("Intl.DateTimeFormat('pt-BR', { minute:'2-digit', hour:'numeric', timeZone: 'UTC' }).format(0)", "'00:00'");
+shouldBe("Intl.DateTimeFormat('pt-BR', { minute:'2-digit', hour:'numeric', timeZone: 'UTC' }).format(0)", "'0:00'");
+shouldBe("Intl.DateTimeFormat('ru', { minute:'2-digit', hour:'2-digit', hour12: false, timeZone: 'UTC' }).format(0)", "'00:00'");
+shouldBe("Intl.DateTimeFormat('ru', { minute:'2-digit', hour:'2-digit', hour12: true, timeZone: 'UTC' }).format(1e7)", "'02:46 ДП'");
 
 shouldThrow("Intl.DateTimeFormat('en', { minute: { toString() { throw 'minute' } } })", "'minute'");
 shouldThrow("Intl.DateTimeFormat('en', { minute:null })", '\'RangeError: minute must be "2-digit" or "numeric"\'');

Modified: trunk/Source/_javascript_Core/ChangeLog (243511 => 243512)


--- trunk/Source/_javascript_Core/ChangeLog	2019-03-26 19:15:56 UTC (rev 243511)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-03-26 19:18:46 UTC (rev 243512)
@@ -1,3 +1,13 @@
+2019-03-26  Andy VanWagoner  <andy@vanwagoner.family>
+
+        Intl.DateTimeFormat should obey 2-digit hour
+        https://bugs.webkit.org/show_bug.cgi?id=195974
+
+        Reviewed by Keith Miller.
+
+        * runtime/IntlDateTimeFormat.cpp:
+        (JSC::IntlDateTimeFormat::initializeDateTimeFormat):
+
 2019-03-25  Yusuke Suzuki  <ysuz...@apple.com>
 
         Heap::isMarked and friends should be instance methods

Modified: trunk/Source/_javascript_Core/runtime/IntlDateTimeFormat.cpp (243511 => 243512)


--- trunk/Source/_javascript_Core/runtime/IntlDateTimeFormat.cpp	2019-03-26 19:15:56 UTC (rev 243511)
+++ trunk/Source/_javascript_Core/runtime/IntlDateTimeFormat.cpp	2019-03-26 19:18:46 UTC (rev 243512)
@@ -633,7 +633,7 @@
     StringView skeletonView(skeleton);
     Vector<UChar, 32> patternBuffer(32);
     status = U_ZERO_ERROR;
-    auto patternLength = udatpg_getBestPattern(generator, skeletonView.upconvertedCharacters(), skeletonView.length(), patternBuffer.data(), patternBuffer.size(), &status);
+    auto patternLength = udatpg_getBestPatternWithOptions(generator, skeletonView.upconvertedCharacters(), skeletonView.length(), UDATPG_MATCH_HOUR_FIELD_LENGTH, patternBuffer.data(), patternBuffer.size(), &status);
     if (status == U_BUFFER_OVERFLOW_ERROR) {
         status = U_ZERO_ERROR;
         patternBuffer.grow(patternLength);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to