3

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.

Rob Hoare
  • 275
  • 1
  • 11

1 Answers1

3

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' }
Community
  • 1
  • 1
Shervin
  • 1,936
  • 17
  • 27
  • 1
    Thanks for this excellent suggestion, a unicode.org based solution is certainly international enough. As they're focussed on current dates that list doesn't include the Julian calendar (used before the Gregorian in many European countries), nor the French Revolutionary calendar, and so on, but they seem to have a method to get new entries added to the list (as it's an user extension that's not essential anyway). Interesting idea to build it up with language/locale as well as that is all useful info for later formatting the date. A well thought out approach, thanks again. – Rob Hoare Sep 22 '13 at 09:40
  • I'm happy that it could help. Also, regarding the less common calendars which are not listed in CLDR data, one can certainly use the user extension as you mentioned. The other option is to propose these calendars to be added to CLDR. Specifically if their date format can be added at least for one of the locales (e.g. Julian and French Revolutionary name of months and days in, say, French and German). I'm not familiar with these calendars, but it's certainly possible to put together a small proposal for them to be considered for adding. – Shervin Sep 22 '13 at 18:49