Cldr.Calendar.weekend-question-mark

You're seeing just the function weekend-question-mark, go back to Cldr.Calendar module for more information.
Link to this function

weekend?(date, options \\ [])

View Source

Specs

weekend?(Date.t(), Keyword.t()) :: boolean() | {:error, {module(), String.t()}}

Returns whether a given date is a weekend day.

Weekend days are locale-specific and depend on the policies of a given territory (country).

Arguments

  • date is any Date.t()

  • options is a Keyword list of options

Options

  • :locale is any locale or locale name validated by Cldr.validate_locale/2. The default is Cldr.get_locale() which returns the locale set for the current process

  • :territory is any valid ISO-3166-2 territory that is validated by Cldr.validate_territory/1

  • :backend is any Cldr backend module. See the backend configuration documentation for further information. The default is Cldr.Calendar.Backend.Default which configures only the en locale.

Notes

When identifying which territory context within which to determine whether a given day is a weekend or not the following order applies:

  • A territory specified by the :territory option

  • The territory defined as part of the :locale option

  • The 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 weekend
# for `001` is Saturday and Sunday
iex> Cldr.Calendar.weekend? ~D[2019-03-23]
true

iex> Cldr.Calendar.weekend? ~D[2019-03-23], locale: "en"
true

iex> Cldr.Calendar.weekend? ~D[2019-03-23], territory: "IS"
true

# In India the official weekend is only Sunday
iex> Cldr.Calendar.weekend? ~D[2019-03-23], locale: "en-IN", backend: MyApp.Cldr
false

# In Israel the weekend starts on Friday
iex> Cldr.Calendar.weekend? ~D[2019-03-22], locale: "he", backend: MyApp.Cldr
true

# As it also does in Saudia Arabia
iex> Cldr.Calendar.weekend? ~D[2019-03-22], locale: "ar-SA", backend: MyApp.Cldr
true

# Sunday is not a weekend day in Saudi Arabia
iex> Cldr.Calendar.weekend? ~D[2019-03-24], locale: "ar-SA", backend: MyApp.Cldr
false