Types
API
- isHoliday(date, region)
- getHolidayByDate(date, region)
- getHolidays(year, region)
- isSunOrHoliday(date, region)
- isSpecificHoliday(date, name, region)
- addTranslation(isoCode, translation)
- setLanguage(lng)
- getLanguage()
All dates are interpreted in German timezone (Europe/Berlin).
The library automatically converts any Date object to German timezone before checking holidays. This ensures correct behavior regardless of your server's timezone setting.
// All of these correctly identify May 29, 2025 as Christi Himmelfahrt:
// UTC timestamp that is May 29 in German timezone
isHoliday(new Date('2025-05-28T23:00:00Z'), 'ALL'); // true (01:00 May 29 in Germany)
// Explicit German timezone
isHoliday(new Date('2025-05-29T00:00:00+02:00'), 'ALL'); // true
// UTC date at noon (timezone-safe)
isHoliday(new Date(Date.UTC(2025, 4, 29, 12, 0, 0)), 'ALL'); // true- For current date checks:
new Date()works perfectly - For specific dates: Use ISO strings with timezone or
Date.UTC()at noon - For server-side code: Use
Date.UTC(year, month, day, 12, 0, 0)for guaranteed timezone independence
Type: ("NEUJAHRSTAG" | "HEILIGEDREIKOENIGE" | "KARFREITAG" | "OSTERSONNTAG" | "OSTERMONTAG" | "TAG_DER_ARBEIT" | "CHRISTIHIMMELFAHRT" | "MARIAHIMMELFAHRT" | "PFINGSTSONNTAG" | "PFINGSTMONTAG" | "FRONLEICHNAM" | "DEUTSCHEEINHEIT" | "REFORMATIONSTAG" | "ALLERHEILIGEN" | "BUBETAG" | "ERSTERWEIHNACHTSFEIERTAG" | "ZWEITERWEIHNACHTSFEIERTAG" | "WELTKINDERTAG" | "WELTFRAUENTAG" | "AUGSBURGER_FRIEDENSFEST")
Type: ("BW" | "BY" | "BE" | "BB" | "HB" | "HE" | "HH" | "MV" | "NI" | "NW" | "RP" | "SL" | "SN" | "ST" | "SH" | "TH" | "BUND" | "AUGSBURG" | "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.
Type: {name: HolidayType, date: Date, dateString: string, regions: Array<Region>, translate: function (lang: string?): string | undefined, equals: function (date: Date): boolean, getNormalizedDate: function (): number}
Properties
nameHolidayType - The holiday identifierdateDate - The date (at noon UTC)dateStringstring - The date as string in German timezone (YYYY-MM-DD format)regionsArray<Region> - Regions where this holiday is validtranslatefunction (lang: string?): string | undefined - Get translated nameequalsfunction (date: Date): boolean - Compare with another date (in German timezone)getNormalizedDatefunction (): number - Get UTC timestamp normalized to midnight
Type: Array<HolidayType>
Map of HolidayType to translation string.
Type: {}
Adds a translation for the holidays (e.g. English). This also allows overriding the German names. Hint: Interpolates German for missing translations
Parameters
isoCodestring of the new languagenewTranslationTranslationTable map of {HolidayType} to translation stringg
Set a language to default language
Parameters
isoCodestring
Get currently set language
Returns string
Checks if a specific date is sunday or holiday in German timezone.
Parameters
Returns boolean
Example
// Check if today is Sunday or a holiday in Bavaria
isSunOrHoliday(new Date(), 'BY');Check if a specific date is a holiday in German timezone.
Parameters
dateDate - Any Date object (will be converted to German timezone)regionRegion two character Region code
Returns boolean
Example
// Check if Christmas is a holiday
isHoliday(new Date(Date.UTC(2025, 11, 25, 12)), 'BY'); // true
// Check with ISO string
isHoliday(new Date('2025-12-25T12:00:00+01:00'), 'BY'); // trueGet the holiday object for a specific date (in German timezone).
Parameters
dateDate - Any Date object (will be converted to German timezone)regionRegion (optional, default'ALL')
Returns (Holiday | void)
Example
const holiday = getHolidayByDate(new Date(Date.UTC(2025, 11, 25, 12)), 'BY');
console.log(holiday?.name); // 'ERSTERWEIHNACHTSFEIERTAG'
console.log(holiday?.translate('de')); // 'Erster Weihnachtsfeiertag'Check if a date is a specific holiday.
Parameters
dateDate - Any Date object (will be converted to German timezone)holidayNameHolidayTyperegionRegion (optional, default'ALL')
Returns boolean
Example
// Check if May 29, 2025 is Christi Himmelfahrt
isSpecificHoliday(new Date(Date.UTC(2025, 4, 29, 12)), 'CHRISTIHIMMELFAHRT'); // trueReturns all holidays of a year in a Region.
Parameters
Example
const holidays = getHolidays(2025, 'BY');
holidays.forEach(h => {
console.log(`${h.dateString}: ${h.translate('de')}`);
});