You're seeing just the function calendar_from_territory, go back to Cldr.Calendar.Preference module for more information.
Link to this function


View Source

Returns the calendar module preferred for a territory.


  • territory is any valid ISO3166-2 code as an String.t or upcased atom()


  • {:ok, calendar_module} or

  • {:error, {exception, reason}}


iex> Cldr.Calendar.Preference.calendar_from_territory :US
{:ok, Cldr.Calendar.US}

iex> Cldr.Calendar.Preference.calendar_from_territory :XX
{:error, {Cldr.UnknownTerritoryError, "The territory :XX is unknown"}}


The overwhelming majority of territories have :gregorian as their first preferred calendar and therefore Cldr.Calendar.Gregorian will be returned for most territories.

Returning any other calendar module would require:

  1. That another calendar is preferred over :gregorian for a territory

  2. That a calendar module is available to support that calendar.

As an example, Iran (territory :IR) prefers the :persian calendar. If the optional library ex_cldr_calendars_persian is installed, the calendar module Cldr.Calendar.Persian will be returned. If it is not installed, Cldr.Calendar.Gregorian will be returned as :gregorian is the second preference for :IR.

Link to this function

calendar_from_territory(territory, calendar)

View Source