Changeset 281371 in webkit


Ignore:
Timestamp:
Aug 21, 2021 6:02:32 AM (11 months ago)
Author:
ysuzuki@apple.com
Message:

[JSC] Extend Intl TimeZoneName Option
https://bugs.webkit.org/show_bug.cgi?id=227831

Reviewed by Ross Kirsling.

JSTests:

  • stress/intl-extended-timezone-names.js: Added.

(shouldBe):
(timeZoneTest):

  • test262/config.yaml:

Source/JavaScriptCore:

https://github.com/tc39/proposal-intl-extend-timezonename

This patch implements Extend Intl TimeZoneName proposal, which adds "shortOffset", "longOffset", "shortGeneric", "longGeneric"
timeZoneName variants.

  • runtime/IntlDateTimeFormat.cpp:

(JSC::IntlDateTimeFormat::setFormatsFromPattern):
(JSC::IntlDateTimeFormat::initializeDateTimeFormat):
(JSC::IntlDateTimeFormat::timeZoneNameString):

  • runtime/IntlDateTimeFormat.h:
Location:
trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r281369 r281371  
     12021-08-21  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Extend Intl TimeZoneName Option
     4        https://bugs.webkit.org/show_bug.cgi?id=227831
     5
     6        Reviewed by Ross Kirsling.
     7
     8        * stress/intl-extended-timezone-names.js: Added.
     9        (shouldBe):
     10        (timeZoneTest):
     11        * test262/config.yaml:
     12
    1132021-08-21  Yusuke Suzuki  <ysuzuki@apple.com>
    214
  • trunk/JSTests/test262/config.yaml

    r280765 r281371  
    3333    - class-static-block
    3434    - Intl.DisplayNames-v2
    35     - Intl.DateTimeFormat-extend-timezonename
    3635    - callable-boundary-realms
    3736  paths:
  • trunk/Source/JavaScriptCore/ChangeLog

    r281370 r281371  
     12021-08-21  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Extend Intl TimeZoneName Option
     4        https://bugs.webkit.org/show_bug.cgi?id=227831
     5
     6        Reviewed by Ross Kirsling.
     7
     8        https://github.com/tc39/proposal-intl-extend-timezonename
     9
     10        This patch implements Extend Intl TimeZoneName proposal, which adds "shortOffset", "longOffset", "shortGeneric", "longGeneric"
     11        timeZoneName variants.
     12
     13        * runtime/IntlDateTimeFormat.cpp:
     14        (JSC::IntlDateTimeFormat::setFormatsFromPattern):
     15        (JSC::IntlDateTimeFormat::initializeDateTimeFormat):
     16        (JSC::IntlDateTimeFormat::timeZoneNameString):
     17        * runtime/IntlDateTimeFormat.h:
     18
    1192021-08-21  Yusuke Suzuki  <ysuzuki@apple.com>
    220
  • trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp

    r278253 r281371  
    412412            break;
    413413        case 'z':
    414         case 'v':
    415         case 'V':
    416414            if (count == 1)
    417415                m_timeZoneName = TimeZoneName::Short;
    418416            else if (count == 4)
    419417                m_timeZoneName = TimeZoneName::Long;
     418            break;
     419        case 'O':
     420            if (count == 1)
     421                m_timeZoneName = TimeZoneName::ShortOffset;
     422            else if (count == 4)
     423                m_timeZoneName = TimeZoneName::LongOffset;
     424            break;
     425        case 'v':
     426        case 'V':
     427            if (count == 1)
     428                m_timeZoneName = TimeZoneName::ShortGeneric;
     429            else if (count == 4)
     430                m_timeZoneName = TimeZoneName::LongGeneric;
    420431            break;
    421432        case 'S':
     
    790801        skeletonBuilder.append('S');
    791802
    792     TimeZoneName timeZoneName = intlOption<TimeZoneName>(globalObject, options, vm.propertyNames->timeZoneName, { { "short"_s, TimeZoneName::Short }, { "long"_s, TimeZoneName::Long } }, "timeZoneName must be \"short\" or \"long\""_s, TimeZoneName::None);
     803    TimeZoneName timeZoneName = intlOption<TimeZoneName>(globalObject, options, vm.propertyNames->timeZoneName, { { "short"_s, TimeZoneName::Short }, { "long"_s, TimeZoneName::Long }, { "shortOffset"_s, TimeZoneName::ShortOffset }, { "longOffset"_s, TimeZoneName::LongOffset }, { "shortGeneric"_s, TimeZoneName::ShortGeneric}, { "longGeneric"_s, TimeZoneName::LongGeneric } }, "timeZoneName must be \"short\", \"long\", \"shortOffset\", \"longOffset\", \"shortGenric\", or \"longGeneric\""_s, TimeZoneName::None);
    793804    RETURN_IF_EXCEPTION(scope, void());
    794805    switch (timeZoneName) {
     
    798809    case TimeZoneName::Long:
    799810        skeletonBuilder.append("zzzz");
     811        break;
     812    case TimeZoneName::ShortOffset:
     813        skeletonBuilder.append('O');
     814        break;
     815    case TimeZoneName::LongOffset:
     816        skeletonBuilder.append("OOOO");
     817        break;
     818    case TimeZoneName::ShortGeneric:
     819        skeletonBuilder.append('v');
     820        break;
     821    case TimeZoneName::LongGeneric:
     822        skeletonBuilder.append("vvvv");
    800823        break;
    801824    case TimeZoneName::None:
     
    11011124    case TimeZoneName::Long:
    11021125        return "long"_s;
     1126    case TimeZoneName::ShortOffset:
     1127        return "shortOffset"_s;
     1128    case TimeZoneName::LongOffset:
     1129        return "longOffset"_s;
     1130    case TimeZoneName::ShortGeneric:
     1131        return "shortGeneric"_s;
     1132    case TimeZoneName::LongGeneric:
     1133        return "longGeneric"_s;
    11031134    case TimeZoneName::None:
    11041135        ASSERT_NOT_REACHED();
  • trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormat.h

    r273138 r281371  
    103103    enum class Minute : uint8_t { None, TwoDigit, Numeric };
    104104    enum class Second : uint8_t { None, TwoDigit, Numeric };
    105     enum class TimeZoneName : uint8_t { None, Short, Long };
     105    enum class TimeZoneName : uint8_t { None, Short, Long, ShortOffset, LongOffset, ShortGeneric, LongGeneric };
    106106    enum class DateTimeStyle : uint8_t { None, Full, Long, Medium, Short };
    107107
Note: See TracChangeset for help on using the changeset viewer.