Question

Is there an international (or widely used) standard code to specify the names of calendar systems?

I'm working on an application that (among other things) stores and presents historical dates in multiple calendar systems, such as Gregorian, Jewish, Hijri, and others. When storing the date, I need to be able to say what calendar system it is in.

I could invent my own system, but is there something already out there, similar to ISO 639 for languages? I haven't been able to find anything after quite a long search, but maybe I've been using the wrong terms.

Was it helpful?

Solution

Valid question; it is always better not to use arbitrary codes for such things.

You can simply use the values of name attribute which CLDR uses:

<key name="ca" description="Calendar algorithm key" alias="calendar">
   <type name="buddhist" description="Thai Buddhist calendar"/>
   <type name="chinese" description="Traditional Chinese calendar"/>
   <type name="coptic" description="Coptic calendar"/>
   ...
   <type name="islamicc" description="Civil (algorithmic) Arabic calendar" deprecated="true" preferred="islamic-civil" alias="islamic-civil"/>
</key>

But you can also, adapt the method that was used in CLDR data definition which consisted of using an extension to BCP47 ("Tags for Identifying Languages") called RFC6067 for "identifying Unicode locale-based variations using language tags. The 'singleton' identifier for this extension is 'u'". For example, the language Thai is identified by th. Therefore, th-u-ca-buddhist identifies the locale as Thai with support for Buddhist calendar:

  th-u-ca-buddhist
     |  |  |
     |  |  +--> Calendar name (values in CLDR bcp47/calendar.xml).
     |  +-----> 2 char key defining extension to follow (here "ca" for calendar).
     +--------> Identifies that extension U values are to follow.

Few more extended usage examples:

  • fa-u-ca-islamic-rgsa: Farsi with Islamic calendar, Saudi Arabia sighting.
  • fa-u-ca-persian: Farsi with Persian calendar.
  • fa_AF-u-ca-persian: Farsi (Afghanistan) with Persian calendar.

Obviously, if your intention is just to store the date and identifier for the calendar it is in, you can use en; i.e.

  { 'year': 1392, 'month': 6 , 'day': 31 , 'calendar': 'en-u-ca-persian' }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top