Skip to content

Latest commit

 

History

History
144 lines (86 loc) · 6 KB

docs.md

File metadata and controls

144 lines (86 loc) · 6 KB

Table of Contents

Types

API

Types

HolidayType

Type: ("NEUJAHRSTAG" | "HEILIGEDREIKOENIGE" | "KARFREITAG" | "OSTERSONNTAG" | "OSTERMONTAG" | "TAG_DER_ARBEIT" | "CHRISTIHIMMELFAHRT" | "MARIAHIMMELFAHRT" | "PFINGSTSONNTAG" | "PFINGSTMONTAG" | "FRONLEICHNAM" | "DEUTSCHEEINHEIT" | "REFORMATIONSTAG" | "ALLERHEILIGEN" | "BUBETAG" | "ERSTERWEIHNACHTSFEIERTAG" | "ZWEITERWEIHNACHTSFEIERTAG" | "WELTKINDERTAG" | "WELTFRAUENTAG" | "AUGSBURGER_FRIEDENSFEST")

Region

Type: ("BW" | "BY" | "BE" | "BB" | "HB" | "HE" | "HH" | "MV" | "NI" | "NW" | "RP" | "SL" | "SN" | "ST" | "SH" | "TH" | "BUND" | "ALL")

As defined here: https://de.wikipedia.org/wiki/Land_(Deutschland)#Amtliche_bzw._Eigenbezeichnungen

The difference between BUND and ALL is defined as follows:

  • "ALL" refers to every holiday which is valid in at least one region. So a holiday that only applies to one state will be included.
  • "BUND" refers to holidays that are valid in every region ("bundesweit"). So a holiday that only applies to one state will not be included.

Holiday

Type: {name: HolidayType, date: Date, trans: function (lang: string?): string, dateString: string, equals: function (date: Date): boolean}

Properties

allHolidays

Type: Array<HolidayType>

allRegions

Type: Array<Region>

TranslationTable

Map of HolidayType to translation string.

Type: {}

API

addTranslation()

Adds a translation for the holidays (e.g. English). This also allows overriding the German names. Hint: Interpolates German for missing translations

Parameters

  • isoCode string of the new language
  • newTranslation TranslationTable map of {HolidayType} to translation stringg

setLanguage()

Set a language to default language

Parameters

getLanguage()

Get currently set language

Returns string

isSunOrHoliday()

Checks if a specific date is sunday or holiday.

Parameters

Returns boolean

isHoliday()

Check is specific date is holiday.

Parameters

Returns boolean

getHolidayByDate()

Parameters

  • date Date
  • region Region (optional, default 'ALL')

Returns (Holiday | void)

isSpecificHoliday()

Parameters

Returns boolean

getHolidays()

Returns all holidays of a year in a Region.

Parameters

Returns Array<Holiday>