Cldr.DateTime.Formatter.period_flex
period_flex, go back to Cldr.DateTime.Formatter module for more information.
Specs
period_flex(Calendar.time(), integer(), Keyword.t()) :: String.t() | {:error, String.t()}
Returns the formatting of the time period as a string, for
example at night (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 veriant of localised flexible time period names if one is available
Notes
The time period may be upper or lowercase depending on the locale and other options. Often there is only one width that is customarily used.
Format Symbol
The representation of the time period is made in accordance with the following table:
| Symbol | Example | Cldr Format |
|---|---|---|
| B, BB, BBB | "at night" | Abbreviated |
| BBBB | "at night" | Wide |
| BBBBB | "at night" | Narrow |
Examples
iex> Cldr.DateTime.Formatter.period_flex %{hour: 11, minute: 5, second: 23}
"in the morning"
iex> Cldr.DateTime.Formatter.period_flex %{hour: 16, minute: 5, second: 23}
"in the afternoon"
iex> Cldr.DateTime.Formatter.period_flex %{hour: 23, minute: 5, second: 23}
"at night"
Specs
period_flex(Calendar.time(), integer(), locale(), Cldr.backend(), Keyword.t()) :: String.t() | {:error, String.t()}