View Source Holidefs (holidefs v0.4.0)

Holidefs is a holiday OTP application for multiple locales that loads the dates from definition files on the startup.

Link to this section Summary

Functions

Returns all the holidays for the given locale between start and finish dates.

Returns the language to translate the holiday names to.

Returns the list of regions from the given locale.

Returns a map of all the supported locales.

Returns all the holidays for the given locale on the given date.

Sets the language to translate the holiday names to.

Returns all the holidays for the given year.

Link to this section Types

Specs

error_reasons() :: :no_def | :invalid_date

Specs

locale_code() :: atom() | binary()

Link to this section Functions

Link to this function

between(locale, start, finish, opts \\ [])

View Source

Specs

between(locale_code(), Date.t(), Date.t(), Holidefs.Options.attrs()) ::
  {:ok, [Holidefs.Holiday.t()]} | {:error, error_reasons()}

Returns all the holidays for the given locale between start and finish dates.

If succeed returns a {:ok, holidays} tuple, otherwise returns a {:error, reason} tuple

Specs

get_language() :: String.t()

Returns the language to translate the holiday names to.

Specs

get_regions(locale_code()) :: {:ok, [String.t()]} | {:error, error_reasons()}

Returns the list of regions from the given locale.

If succeed returns a {:ok, regions} tuple, otherwise returns a {:error, reason} tuple.

Specs

locales() :: map()

Returns a map of all the supported locales.

The key is the code and the value the name of the locale.

Link to this function

on(locale, date, opts \\ [])

View Source

Specs

Returns all the holidays for the given locale on the given date.

If succeed returns a {:ok, holidays} tuple, otherwise returns a {:error, reason} tuple.

Specs

set_language(atom() | String.t()) :: nil

Sets the language to translate the holiday names to.

To use the native language names, you can set the language to :orig

Link to this function

year(locale, year, opts \\ [])

View Source

Specs

year(locale_code(), integer(), Holidefs.Options.attrs()) ::
  {:ok, [Holidefs.Holiday.t()]} | {:error, error_reasons()}

Returns all the holidays for the given year.

If succeed returns a {:ok, holidays} tuple, otherwise returns a {:error, reason} tuple