Cldr.Calendar.weekday-question-mark
weekday-question-mark
, go back to Cldr.Calendar module for more information.
Specs
Returns whether a given date is a weekday.
Weekdays are locale-specific and depend on the policies of a given territory (country).
Arguments
date
is anyDate.t()
options
is a Keyword list of options
Options
:locale
is any locale or locale name validated byCldr.validate_locale/2
. The default isCldr.get_locale()
which returns the locale set for the current process:territory
is any valid ISO-3166-2 territory that is validated byCldr.validate_territory/1
:backend
is anyCldr
backend module. See the backend configuration documentation for further information. The default isCldr.Calendar.Backend.Default
which configures only theen
locale.
Notes
When identifying which territory context within which to determine whether a given day is a weekday or not the following order applies:
A territory specified by the
:territory
optionThe territory defined as part of the
:locale
optionThe territory defined as part of the current processes default locale.
Examples
# The defalt locale for `Cldr` is `en-001` for which
# the territory is `001` (the world). The weekdays
# for `001` are Monday to Friday
iex> Cldr.Calendar.weekday? ~D[2019-03-23], locale: "en"
false
iex> Cldr.Calendar.weekday? ~D[2019-03-23], territory: "IS"
false
# Saturday is a weekday in India
iex> Cldr.Calendar.weekday? ~D[2019-03-23], locale: "en-IN", backend: MyApp.Cldr
true
# Friday is not a weekday in Saudi Arabia
iex> Cldr.Calendar.weekday? ~D[2019-03-22], locale: "ar-SA", backend: MyApp.Cldr
false
# Friday is not a weekday in Israel
iex> Cldr.Calendar.weekday? ~D[2019-03-22], locale: "he", backend: MyApp.Cldr
false