Skip to content

Integrate with Intl Era and Month Codes proposal #526

@ptomato

Description

@ptomato

In all our pseudocode examples supposing a Japanese calendar thus far, we've been passing in era names as lowercased ASCII string identifiers made from English transliterations of the names, e.g. { year: 2, era: 'reiwa' } for the current year. That requires that these identifiers are unique. However, that seems not to be the case as there are several eras written with different kanji but with the same English transliteration.

The ICU names (which I guess must be for output only, not input) disambiguate this by adding a range of years to all of the era names in Latin locales except the most recent five. (For example in the C locale: https://github.com/unicode-org/icu/blob/master/icu4c/source/data/locales/root.txt#L1582-L1818)

What to do for input? Requiring the user to specify the era as a numerical index is extremely unergonomic, (for example, { year: 2, era: 181 }) because they're not otherwise referred to numerically as far as I can tell. This could be mitigated with numeric constants?

There must be some sort of prior art for software that does these calculations.

For background and a list of eras: https://en.wikipedia.org/wiki/Japanese_era_name — disclaimer, all I pretend to know about this calendar comes from that Wikipedia page.

This may be a problem in other calendars as well if they use non-numerical identifiers for things. I don't know if that's the case in any other calendars.


These are the duplicate names in the ICU data:

  • Jōgen - ISO years 976–978 (貞元) and 1207–1211 (承元)
  • Shōryaku - ISO years 990–995 (正暦) and 1077–1081 (承暦)
  • Eishō - ISO years 1046–1053 (永承) and 1504–1521 (永正)
  • Shōhō - ISO years 1074–1077 (承保) and 1644–1648 (正保)
  • Kōwa - ISO years 1099–1104 (康和) and 1381–1384 (弘和)
  • Tenshō - ISO years 1131–1132 (天承) and 1573–1592 (天正)
  • Kōji - ISO years 1142–1144 (康治) and 1555–1558 (弘治)
  • Shōan - ISO years 1171–1175 (承安) and 1299–1302 (正安)
  • Jōō - ISO years 1222–1224 (貞応) and 1652–1655 (承応)
  • Enkyō - ISO years 1308–1311 (延慶) and 1744–1748 (延享)
  • Shōwa - ISO years 1312–1317 (正和) and 1926–1989 (昭和)
  • Genkō - ISO years 1321–1324 (元亨) and 1331–1334 (元弘)

Note: Meitoku appears twice as well, from ISO years 1384­–1387 and 1390–1394, but Wikipedia lists just one Meitoku era, and new Date('1385-01-01').toLocaleString('ja-JP-u-ca-japanese', {era: 'short'}) shows the Genchū era instead.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions