1 of 13

Extend TimeZoneName Option Proposal for Stage 2

2 of 13

Motivation / Scope

Extend the timeZoneName option in Intl.DateTimeFormat object to support more formatted options.

3 of 13

Scope / Prior Arts / Underline Supportive Library & Data

Add four new values to TimeZoneName option in Intl.DateTimeFormat: “short”, “long”, “shortOffset”, “longOffset”, “shortWall”, “longWall”

“shortOffset”, “longOffset”

Cbanged

4 of 13

Sample Usage in English Locale

d8> let timeZoneNames = ["short", "long", "shortOffset", "longOffset", "shortWall", "longWall"];

d8> timeZoneNames.forEach(function(timeZoneName) { print((new Date()).toLocaleTimeString("en", {timeZoneName}))});

9:27:14 AM PST

9:27:14 AM Pacific Standard Time

9:27:14 AM GMT-8

9:27:14 AM GMT-08:00

9:27:14 AM PT

9:27:14 AM Pacific Time

5 of 13

Sample Usage in Traditional Chinese Locale (zh-CN)

d8> let timeZoneNames = ["short", "long", "shortOffset", "longOffset", "shortWall", "longWall"];

d8> timeZoneNames.forEach(function(timeZoneName) { print((new Date()).toLocaleTimeString("zh-Hant", {timeZoneName}))});

上午9:27:27 [PST]

上午9:27:27 [太平洋標準時間]

上午9:27:27 [GMT-8]

上午9:27:27 [GMT-08:00]

上午9:27:27 [PT]

上午9:27:27 [太平洋時間]

6 of 13

ECMA-402 Stage 2 & 3 Requirements

  • Prior Art - ICU/ICU4J and many others
  • Difficult to Implement in Userland
  • Broad Appeal

  • Payload Mitigation

7 of 13

Examples of “Wall Time” Usage

Broad Appeal

8 of 13

Concerns about Data Size Increase

  • shortOffset & longOffset:
    • # of items in 476 locales: 263
    • Total Bytes in UTF8: 1,826 bytes
    • Compressed Size: 392 bytes
  • shortWall:
    • # of items in 476 locales: 332
    • Total Bytes in UTF8: 1,719 bytes
    • Compressed Size: 311 bytes
  • longWall:
    • # of items in 476 locales: 10,047
    • Total Bytes in UTF8: 278,103 bytes
    • Compressed Size: 69,526 bytes

Note: Several other possible values of timeZoneName were removed from earlier proposal after we exam the size impact during Stage 0

Payload Mitigation

9 of 13

History

  • Advanced to Stage 1 in TC39 2021-01 Meeting
    • Acceptance Signifies for Stage 1: “The committee expects to devote time to examining the problem space, solutions and cross-cutting concerns”
  • ECMA402 2021-04 Monthly Meeting
    • Recommend to rename shortGMT/longGMT to shortOffset/longOffset
    • Support to proceed to TC39 for Stage 2 advancement

10 of 13

References

  • Reviewers: TBD / TBD
  • Editors: TBD

11 of 13

Entrance Criteria / Acceptance Signifies�For Stage 2

Entrance Criteria:

Acceptance Signifies:

  • Stage 1: “The committee expects to devote time to examining the problem space, solutions and cross-cutting concerns”
  • Stage 2: “The committee expects the feature to be developed and eventually included in the standard

12 of 13

Requesting the Committee Approval for advancement to Stage 2��Requesting 2 members to serve as Stage 3 Reviewers

13 of 13

Entrance Criteria For Stage 1

  • Identified “champion” who will advance the addition: DONE- @FrankYFTang
  • Prose outlining the problem or need and the general shape of a solution DONE
  • Illustrative examples of usage DONE
  • High-level API DONE
  • Discussion of key algorithms, abstractions and semantics DONE
  • Identification of potential “cross-cutting” concerns and implementation challenges/complexity DONE
  • A publicly available repository for the proposal that captures the above requirements: DONEhttps://github.com/FrankYFTang/proposal-intl-extend-timezonename/