1 of 14

Intl Enumeration API�for Stage 1

Frank Yung-Fong Tang / 譚永鋒� ftang@google.com

June 3, 2020

https://github.com/FrankYFTang/proposal-intl-enumeration

2 of 14

Charter of “Intl Enumeration API”

List supported values of options in pre-existing ECMA 402 API.

3 of 14

Motivation / Background

4 of 14

Scope

Includes other values of option in ECMA402 API:

  • Calendar
  • Currency
  • NumberingSystems [listed in Table 4]
  • TimeZone
  • Unit [listed in Table 2]

5 of 14

High-level API

6 of 14

Find out the supported calendars

Intl.getSupportedCalendars()�// ['buddhist', 'chinese', 'coptic', 'dangi', 'ethioaa',�// 'ethiopic', 'gregory', 'hebrew', 'indian', �// ...�// 'persian', 'roc', 'islamicc'];

7 of 14

Find out the supported currencies

Intl.getSupportedCurrencies()

// ['AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', �// ...�// 'SVC', 'XDR', 'XSU', 'ZWL'];

  • Note: Currency are ISO 4217 currency code.

8 of 14

Find out the supported numbering systems

Intl.getSupportedNumberingSystems()

// ['adlm', 'ahom', 'arab', 'arabext', 'bali', 'beng',�// 'bhks', 'brah', 'cakm', 'cham', 'deva', 'fullwide',�// …�// 'thai', 'tibt', 'tirh', 'vaii', 'wara', 'wcho'];

  • Note: Numbering System IDs are listed in Table 4 in ECMA402 and allow implementation to support more.

9 of 14

Find out the supported time zones

Intl.getSupportedTimeZones()

// ['Africa/Abidjan', 'Africa/Accra', �// 'Africa/Addis_Ababa', 'Africa/Algiers',�// 'Africa/Asmera', 'Africa/Bamako', 'Africa/Bangui',�// …�// 'Pacific/Truk', 'Pacific/Wake', 'Pacific/Wallis'];

  • Note: Time Zone IDs are key of IANA TimeZone DB.

10 of 14

Find out the supported units

Intl.getSupportedUnits()

// ['acre', 'bit', 'byte', 'celsius', 'centimeter',�// 'day', 'degree', 'fahrenheit', 'fluid-ounce', �// 'foot', 'gallon',�// …�// 'terabit', 'terabyte', 'week', 'yard', 'year'];

  • Note: Units are listed in Table 2 in ECMA402 and restrict implementation to support more.

11 of 14

Possible Changes / Enhancements in Stage 1

  • The scope
  • Add criteria parameter as options:
    • Ex: Return the time zones used in “US”
    • Ex: Return the calendar used in “JP” (Japan)
    • Ex: Return the numbering systems used in “IN” (India)

12 of 14

Potential Concerns

Polyfill

  • Privacy / Fingerprinting

13 of 14

Request for TC39

ECMA402 2020-5-21 Monthly Meeting

Stage 1 Advancement

Agree to bring to TC39 for stage 1 advancement discussion

14 of 14

Stage 1 Entrance Criteria

  • Identified “champion” who will advance the addition
  • Prose outlining the problem or need and the general shape of a solution
  • Illustrative examples of usage
  • High-level API
  • Discussion of key algorithms, abstractions and semantics
  • Identification of potential “cross-cutting” concerns and implementation challenges/complexity
  • A publicly available repository for the proposal that captures the above requirements�https://tc39.es/process-document/

Frank Yung-Fong Tang

Previous slides

Used with Temporal / Intl.DateTimeFormat

Fingerprinting

Will move under tc39