Cldr.DateTime.Formatter.period_noon_midnight
period_noon_midnight, go back to Cldr.DateTime.Formatter module for more information.
Specs
period_noon_midnight(Calendar.time(), integer(), Keyword.t()) :: String.t() | {:error, String.t()}
Returns the formatting of the time period as either
noon, midnight or am/pm (format symbol 'b').
Arguments
timeis aTimestruct or any map that contains at least the key:secondnin an integer between 1 and 5 that determines the format of the time periodlocaleis any valid locale name returned byCldr.known_locale_names/0or aCldr.LanguageTagstruct. The default isCldr.get_locale/0optionsis aKeywordlist of options. The available option isperiod: :variantwhich will use a variant of localised "noon" and "midnight" if one is available
Notes
If the langauge doesn't support "noon" or "midnight" then
am/pm is used for all time periods.
May be upper or lowercase depending on the locale and other options.
If the locale doesn't have the notion of a unique noon == 12:00,
then the PM form may be substituted. Similarly for midnight == 00:00
and the AM form.
Format Symbol
The representation of the time period is made in accordance with the following table:
| Symbol | Example | Cldr Format |
|---|---|---|
| b, bb, bbb | "mid." | Abbreviated |
| bbbb | "midnight" | Wide |
| bbbbb | "md" | Narrow |
Examples
iex> Cldr.DateTime.Formatter.period_noon_midnight %{hour: 12, minute: 0}
"noon"
iex> Cldr.DateTime.Formatter.period_noon_midnight %{hour: 0, minute: 0}
"midnight"
iex> Cldr.DateTime.Formatter.period_noon_midnight %{hour: 11, minute: 0}
"in the morning"
iex> Cldr.DateTime.Formatter.period_noon_midnight %{hour: 16, minute: 0}
"PM"
Specs
period_noon_midnight( Calendar.time(), integer(), locale(), Cldr.backend(), Keyword.t() ) :: String.t() | {:error, String.t()}