holidefs v0.2.0 Holidefs View Source

Holdefs 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 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

Link to this type error_reasons() View Source
error_reasons() :: :no_def | :invalid_date

Link to this section Functions

Link to this function between(locale, start, finish, opts \\ []) View Source
between(atom(), Date.t(), Date.t(), Holidefs.Options.t()) ::
  {: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

Link to this function get_language() View Source
get_language() :: String.t()

Returns the language to translate the holiday names to.

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
on(atom(), Date.t(), Holidefs.Options.t()) ::
  {:ok, [Holidefs.Holiday.t()]} | {:error, error_reasons()}

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.

Link to this function set_language(locale) View Source
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
year(atom(), integer(), Holidefs.Options.t()) ::
  {: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