plotex v0.2.1 Plotex.Cldr.Calendar
Data functions to retrieve localised calendar information.
Cldr
defines formats for several calendars, the names of which
are returned by Cldr.known_calendars/0
.
Currently this implementation only supports the :gregorian
calendar which aligns with the proleptic Gregorian calendar
defined by Elixir, Calendar.ISO
.
Link to this section Summary
Functions
Returns a keyword list of options than can be applied to
NimbleStrftime.format/3
.
Link to this section Functions
day_periods(locale \\ Plotex.Cldr.get_locale(), calendar \\ :gregorian)
days(locale \\ Plotex.Cldr.get_locale(), calendar \\ :gregorian)
eras(locale \\ Plotex.Cldr.get_locale(), calendar \\ :gregorian)
months(locale \\ Plotex.Cldr.get_locale(), calendar \\ :gregorian)
quarters(locale \\ Plotex.Cldr.get_locale(), calendar \\ :gregorian)
strftime_options!(locale \\ Plotex.Cldr.get_locale(), options \\ [])
Returns a keyword list of options than can be applied to
NimbleStrftime.format/3
.
The hex package nimble_strftime
provides a format/3
function to format dates, times and datetimes.
It takes a set of options that can return day, month and am/pm names.
strftime_options!
returns a keyword list than can be used as these
options to return localised names for days, months and am/pm.
Arguments
locale
is any locale returned byMyApp.Cldr.known_locales/0
. The default isMyApp.Cldr.get_locale/0
options
is a set of keyword options. The default is[]
Options
:calendar
is the name of any known CLDR calendar. The default is:gregorian
.
Example
iex: MyApp.Cldr.Calendar.strftime_options!
[
am_pm_names: #Function<0.32021692/1 in MyApp.Cldr.Calendar.strftime_options/2>,
month_names: #Function<1.32021692/1 in MyApp.Cldr.Calendar.strftime_options/2>,
abbreviated_month_names: #Function<2.32021692/1 in MyApp.Cldr.Calendar.strftime_options/2>,
day_of_week_names: #Function<3.32021692/1 in MyApp.Cldr.Calendar.strftime_options/2>,
abbreviated_day_of_week_names: #Function<4.32021692/1 in MyApp.Cldr.Calendar.strftime_options/2>
]
Typical usage
iex: NimbleStrftime.format(Date.today(), MyApp.Cldr.Calendar.strftime_options!())