⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 243512 in webkit


Ignore:
Timestamp:
Mar 26, 2019, 12:18:46 PM (7 years ago)
Author:
andy@vanwagoner.family
Message:

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

Reviewed by Keith Miller.

Source/JavaScriptCore:

  • runtime/IntlDateTimeFormat.cpp:

(JSC::IntlDateTimeFormat::initializeDateTimeFormat):

LayoutTests:

  • js/intl-datetimeformat-expected.txt:
  • js/script-tests/intl-datetimeformat.js:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r243506 r243512  
     12019-03-26  Andy VanWagoner  <andy@vanwagoner.family>
     2
     3        Intl.DateTimeFormat should obey 2-digit hour
     4        https://bugs.webkit.org/show_bug.cgi?id=195974
     5
     6        Reviewed by Keith Miller.
     7
     8        * js/intl-datetimeformat-expected.txt:
     9        * js/script-tests/intl-datetimeformat.js:
     10
    1112019-03-26  Dean Jackson  <dino@apple.com>
    212
  • trunk/LayoutTests/js/intl-datetimeformat-expected.txt

    r234475 r243512  
    311311PASS Intl.DateTimeFormat('en', { hour:[] }) threw exception RangeError: hour must be "2-digit" or "numeric".
    312312PASS Intl.DateTimeFormat('en').resolvedOptions().hour is undefined
    313 PASS Intl.DateTimeFormat('en', { minute:'2-digit', hour:'2-digit' }).resolvedOptions().hour is 'numeric'
     313PASS Intl.DateTimeFormat('en', { minute:'2-digit', hour:'2-digit' }).resolvedOptions().hour is '2-digit'
    314314PASS Intl.DateTimeFormat('en', { minute:'2-digit', hour:'2-digit', timeZone: 'UTC' }).format(0) is '12:00 AM'
    315315PASS Intl.DateTimeFormat('en', { minute:'2-digit', hour:'numeric' }).resolvedOptions().hour is 'numeric'
     
    321321PASS Intl.DateTimeFormat('pt-BR', { minute:'2-digit', hour:'numeric' }).resolvedOptions().hourCycle is 'h23'
    322322PASS Intl.DateTimeFormat('pt-BR', { minute:'2-digit', hour:'numeric' }).resolvedOptions().hour12 is false
    323 PASS Intl.DateTimeFormat('pt-BR', { minute:'2-digit', hour:'numeric', timeZone: 'UTC' }).format(0) is '00:00'
     323PASS Intl.DateTimeFormat('pt-BR', { minute:'2-digit', hour:'numeric', timeZone: 'UTC' }).format(0) is '0:00'
     324PASS Intl.DateTimeFormat('ru', { minute:'2-digit', hour:'2-digit', hour12: false, timeZone: 'UTC' }).format(0) is '00:00'
     325PASS Intl.DateTimeFormat('ru', { minute:'2-digit', hour:'2-digit', hour12: true, timeZone: 'UTC' }).format(1e7) is '02:46 ДП'
    324326PASS Intl.DateTimeFormat('en', { minute: { toString() { throw 'minute' } } }) threw exception minute.
    325327PASS Intl.DateTimeFormat('en', { minute:null }) threw exception RangeError: minute must be "2-digit" or "numeric".
  • trunk/LayoutTests/js/script-tests/intl-datetimeformat.js

    r234475 r243512  
    424424shouldThrow("Intl.DateTimeFormat('en', { hour:[] })", '\'RangeError: hour must be "2-digit" or "numeric"\'');
    425425shouldBe("Intl.DateTimeFormat('en').resolvedOptions().hour", "undefined");
    426 shouldBe("Intl.DateTimeFormat('en', { minute:'2-digit', hour:'2-digit' }).resolvedOptions().hour", "'numeric'");
     426shouldBe("Intl.DateTimeFormat('en', { minute:'2-digit', hour:'2-digit' }).resolvedOptions().hour", "'2-digit'");
    427427shouldBe("Intl.DateTimeFormat('en', { minute:'2-digit', hour:'2-digit', timeZone: 'UTC' }).format(0)", "'12:00 AM'");
    428428shouldBe("Intl.DateTimeFormat('en', { minute:'2-digit', hour:'numeric' }).resolvedOptions().hour", "'numeric'");
     
    435435shouldBe("Intl.DateTimeFormat('pt-BR', { minute:'2-digit', hour:'numeric' }).resolvedOptions().hourCycle", "'h23'");
    436436shouldBe("Intl.DateTimeFormat('pt-BR', { minute:'2-digit', hour:'numeric' }).resolvedOptions().hour12", "false");
    437 shouldBe("Intl.DateTimeFormat('pt-BR', { minute:'2-digit', hour:'numeric', timeZone: 'UTC' }).format(0)", "'00:00'");
     437shouldBe("Intl.DateTimeFormat('pt-BR', { minute:'2-digit', hour:'numeric', timeZone: 'UTC' }).format(0)", "'0:00'");
     438shouldBe("Intl.DateTimeFormat('ru', { minute:'2-digit', hour:'2-digit', hour12: false, timeZone: 'UTC' }).format(0)", "'00:00'");
     439shouldBe("Intl.DateTimeFormat('ru', { minute:'2-digit', hour:'2-digit', hour12: true, timeZone: 'UTC' }).format(1e7)", "'02:46 ДП'");
    438440
    439441shouldThrow("Intl.DateTimeFormat('en', { minute: { toString() { throw 'minute' } } })", "'minute'");
  • trunk/Source/JavaScriptCore/ChangeLog

    r243467 r243512  
     12019-03-26  Andy VanWagoner  <andy@vanwagoner.family>
     2
     3        Intl.DateTimeFormat should obey 2-digit hour
     4        https://bugs.webkit.org/show_bug.cgi?id=195974
     5
     6        Reviewed by Keith Miller.
     7
     8        * runtime/IntlDateTimeFormat.cpp:
     9        (JSC::IntlDateTimeFormat::initializeDateTimeFormat):
     10
    1112019-03-25  Yusuke Suzuki  <ysuzuki@apple.com>
    212
  • trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp

    r243311 r243512  
    634634    Vector<UChar, 32> patternBuffer(32);
    635635    status = U_ZERO_ERROR;
    636     auto patternLength = udatpg_getBestPattern(generator, skeletonView.upconvertedCharacters(), skeletonView.length(), patternBuffer.data(), patternBuffer.size(), &status);
     636    auto patternLength = udatpg_getBestPatternWithOptions(generator, skeletonView.upconvertedCharacters(), skeletonView.length(), UDATPG_MATCH_HOUR_FIELD_LENGTH, patternBuffer.data(), patternBuffer.size(), &status);
    637637    if (status == U_BUFFER_OVERFLOW_ERROR) {
    638638        status = U_ZERO_ERROR;
Note: See TracChangeset for help on using the changeset viewer.