Cldr.DateTime.Formatter.era
You're seeing just the function
era
, go back to Cldr.DateTime.Formatter module for more information.
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 aDate
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 yearlocale
is any valid locale name returned byCldr.known_locale_names/0
or aCldr.LanguageTag
struct. The default isCldr.get_locale/0
options
is aKeyword
list of options. The only applicable option is:era
with a value of eithernil
(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:
Symbol | Example | Cldr Format |
---|---|---|
G, GG, GGG | "AD" | Abbreviated |
GGGG | "Anno Domini | Wide |
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"
Specs
era(Calendar.date(), integer(), locale(), Cldr.backend(), Keyword.t()) :: String.t() | {:error, String.t()}