Cldr.DateTime.Formatter.era

You're seeing just the function era, go back to Cldr.DateTime.Formatter module for more information.
Link to this function

era(era, n \\ 1, options \\ [])

View Source

Specs

era(Calendar.date(), integer(), Keyword.t()) ::
  String.t() | {:error, String.t()}

Returns the era (format symbol G) of a date for given locale.

Arguments

  • date is a Date struct or any map that contains at least the keys :month and :calendar

  • n in an integer between 1 and 5 that determines the format of the year

  • locale is any valid locale name returned by Cldr.known_locale_names/0 or a Cldr.LanguageTag struct. The default is Cldr.get_locale/0

  • options is a Keyword list of options. The only applicable option is :era with a value of either nil (the default) or :variant which will return the variant form of an era if one is available.

Format Symbol

The representation of the era is made in accordance with the following table:

SymbolExampleCldr Format
G, GG, GGG"AD"Abbreviated
GGGG"Anno DominiWide
GGGGG"A"Narrow

Examples

iex> Cldr.DateTime.Formatter.era ~D[2017-12-01], 1
"AD"

iex> Cldr.DateTime.Formatter.era ~D[2017-12-01], 4, "fr", MyApp.Cldr
"après Jésus-Christ"
Link to this function

era(date, n, locale, backend, options \\ [])

View Source

Specs

era(Calendar.date(), integer(), locale(), Cldr.backend(), Keyword.t()) ::
  String.t() | {:error, String.t()}