View Source Holidex.Countries.Canada (Holidex v0.1.1)

Provides public holiday observances for Canadian holidays. Each province and territory in Canada has the authority to establish its own holiday schedule and observance rules.

Summary

Types

An atom representing a supported holiday name.

An atom representing a Province or Territory short code.

Types

@type holiday_name() ::
  :new_years_day
  | :family_day
  | :st_patricks_day
  | :good_friday
  | :easter_sunday
  | :easter_monday
  | :st_georges_day
  | :victoria_day
  | :canada_day
  | :orangemans_day
  | :nunavut_day
  | :civic_holiday
  | :discovery_day
  | :labour_day
  | :thanksgiving_day
  | :christmas_day
  | :boxing_day

An atom representing a supported holiday name.

@type region_code() ::
  :ab | :bc | :mb | :nb | :nl | :nt | :nv | :nt | :on | :pe | :qc | :sk | :yt

An atom representing a Province or Territory short code.

@type year() :: 1900..2200

Functions

@spec holiday(holiday_name :: holiday_name(), year()) ::
  Holidex.NationalHoliday.t() | ArgumentError

Retrieves holiday information for a holiday in a given year.

Parameters

  • holiday_name: The name of the holiday as an atom (e.g., :new_years_day)
  • year: The year for which to retrieve the holiday information

Returns

A Holidex.NationalHoliday struct containing the holiday information.

Examples

iex> Holidex.Countries.Canada.holiday(:canada_day, 2023)
%Holidex.NationalHoliday{name: "Canada Day", date: ~D[2023-07-01], ...}
@spec holidays(year()) ::
  {:ok, [Holidex.NationalHoliday.t()]} | {:error, atom()} | ArgumentError
Link to this function

holidays_by_region(region_code, year)

View Source
@spec holidays_by_region(region_code(), integer()) ::
  {:ok, [Holidex.RegionalHoliday.t()]} | {:error, atom()}
Link to this function

national_to_regional(national, region_code)

View Source
@spec region_codes() :: [atom()]
@spec regions() :: [map()]