Skip to content

Support for non-gregorian calendars #320

Open
@rxaviers

Description

WIP PR #447


CLDR has data for a variety of different calendars (listed in the table below). Globalize 0.x supported some non-gregorian calendars. But, Globalize 1.x hasn't migrated them yet (it supports the gregorian calendar only).

Calendar Globalize 0.x Globalize 1.x ibm-js/ecma402 dojo
buddhist (Thai Buddhist calendar) x x x
chinese (Traditional Chinese calendar)
coptic (Coptic calendar)
dangi (Traditional Korean calendar)
ethioaa (Ethiopic calendar, Amete Alem (epoch approx. 5493 B.C.E))
ethiopic (Ethiopic calendar, Amete Mihret (epoch approx, 8 C.E.))
gregory (Gregorian calendar) x x x x
hebrew (Traditional Hebrew calendar) x x
indian (Indian calendar)
islamic (Islamic calendar) x x x
islamic-umalqura (Islamic calendar, Umm al-Qura) x x x
islamic-tbla (Islamic calendar, tabular (intercalary years [2,5,7,10,13,16,18,21,24,26,29] - astronomical epoch))
islamic-civil (Islamic calendar, tabular (intercalary years [2,5,7,10,13,16,18,21,24,26,29] - civil epoch)) x
islamic-rgsa (Islamic calendar, Saudi Arabia sighting)
iso8601 (ISO calendar (Gregorian calendar using the ISO 8601 calendar week rules))
japanese (Japanese Imperial calendar) x
persian (Persian calendar) x
roc (Republic of China calendar) x
islamicc (Civil (algorithmic) Arabic calendar)

We haven't been requested so far to support any non-gregorian calendar. Therefore, our priority is (1) first to support the previously supported calendars on 0.x, (2) then to support any other non-gregorian calendar.

References:

Unicode Technical Standard 35 describes three locale extension keys that are relevant to date and time formatting, "ca" for calendar, "tz" for time zone, and implicitly "nu" for the numbering system of the number format used for numbers within the date format. DateTimeFormat, however, requires that the time zone is specified through the timeZone property in the options objects.

Follow the calendar preference per territory: (use 001 as a default for countries not listed there)

"calendarPreferenceData": {
  "001": "gregorian",
  "AE": "gregorian islamic-umalqura islamic islamic-civil islamic-tbla",
  "AF": "persian gregorian islamic islamic-civil islamic-tbla",
  "BH": "gregorian islamic-umalqura islamic islamic-civil islamic-tbla",
  "CN": "gregorian chinese",
  "CX": "gregorian chinese",
  "DJ": "gregorian islamic islamic-civil islamic-tbla",
  "DZ": "gregorian islamic islamic-civil islamic-tbla",
  "EG": "gregorian coptic islamic islamic-civil islamic-tbla",
  "EH": "gregorian islamic islamic-civil islamic-tbla",
  "ER": "gregorian islamic islamic-civil islamic-tbla",
  "ET": "gregorian ethiopic",
  "HK": "gregorian chinese",
  "IL": "gregorian hebrew islamic islamic-civil islamic-tbla",
  "IN": "gregorian indian",
  "IQ": "gregorian islamic islamic-civil islamic-tbla",
  "IR": "persian gregorian islamic islamic-civil islamic-tbla",
  "JO": "gregorian islamic islamic-civil islamic-tbla",
  "JP": "gregorian japanese",
  "KM": "gregorian islamic islamic-civil islamic-tbla",
  "KR": "gregorian dangi",
  "KW": "gregorian islamic-umalqura islamic islamic-civil islamic-tbla",
  "LB": "gregorian islamic islamic-civil islamic-tbla",
  "LY": "gregorian islamic islamic-civil islamic-tbla",
  "MA": "gregorian islamic islamic-civil islamic-tbla",
  "MO": "gregorian chinese",
  "MR": "gregorian islamic islamic-civil islamic-tbla",
  "OM": "gregorian islamic islamic-civil islamic-tbla",
  "PS": "gregorian islamic islamic-civil islamic-tbla",
  "QA": "gregorian islamic-umalqura islamic islamic-civil islamic-tbla",
  "SA": "gregorian islamic-umalqura islamic islamic-rgsa",
  "SD": "gregorian islamic islamic-civil islamic-tbla",
  "SG": "gregorian chinese",
  "SY": "gregorian islamic islamic-civil islamic-tbla",
  "TD": "gregorian islamic islamic-civil islamic-tbla",
  "TH": "buddhist gregorian",
  "TN": "gregorian islamic islamic-civil islamic-tbla",
  "TW": "gregorian roc chinese",
  "YE": "gregorian islamic islamic-civil islamic-tbla"
}

Tests

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions