feiertagejs
v1.5.0
Published
A module to calculate German holidays made for node.js
Maintainers
Readme
Feiertage.js
Feiertage.js is a small typescript npm module without dependencies to calculate German holidays for each Bundesland.
Installation
- yarn:
yarn add feiertagejs - npm:
npm install feiertagejs - bower:
bower install feiertagejsoutdated! - Plain Javascript outdated!
If you are looking for a day.js plugin find it in this repository.
Quick Examples
ES Modules (Typescript/Javasript)
The prefered way is to directly import the typescript module. However, you can also use .js. Please find here some examples and full api here.
import { getHolidays, isHoliday, isSpecificHoliday } from 'feiertagejs';
const today = new Date();
// is today a holiday?
isHoliday(today, 'BW'); // false -- probably false, because you are working ;)
// check if a day is a specific holiday
isSpecificHoliday(today, 'CHRISTIHIMMELFAHRT', 'ALL'); // true | false
// get all holiday for a single year: getHolidays()
// returns an array of "Holiday" Objects. Please see the docs.md for all properties.
const holidays2023 = getHolidays('2023', 'BUND');
holidays2023[0].date // Date object
holidays2023[0].dateString // '2023-01-01' (in German timezone)
holidays2023[0].name // 'NEUJAHRSTAG' (constant)
holidays2023[0].translate('de') // German translation: Neujahrstag
holidays2023[0].equals(date) // Compare days only (ignore time)One entry of the array contains:
[{
name: 'CHRISTIHIMMELFAHRT',
date: new Date('2023-05-18T10:00:00.000Z'),
dateString: '2023-05-18',
regions: [
'BW', 'BY', 'BE',
'BB', 'HB', 'HE',
'HH', 'MV', 'NI',
'NW', 'RP', 'SL',
'SN', 'ST', 'SH',
'TH', 'BUND', 'AUGSBURG',
'ALL'
],
translate: [Function: translate],
getNormalizedDate: [Function: getNormalizedDate],
equals: [Function: equals]
}
]
Timezone Handling
All dates are interpreted in German timezone (Europe/Berlin).
This means:
new Date('2025-05-28T23:00:00Z')(UTC) is2025-05-29 01:00in Germany → recognized as May 29th- The library correctly handles CET (UTC+1) and CEST (UTC+2) daylight saving time
Creating Dates
You can pass dates in several ways:
// Option 1: Regular Date object (interpreted in German timezone)
isHoliday(new Date(), 'BY');
// Option 2: ISO string with timezone (recommended for specific dates)
isHoliday(new Date('2025-12-25T00:00:00+01:00'), 'BY'); // Christmas in CET
// Option 3: UTC date at noon (timezone-safe for any server location)
const christmas = new Date(Date.UTC(2025, 11, 25, 12, 0, 0));
isHoliday(christmas, 'BY');Best Practice: When running code on servers in different timezones, use UTC dates at noon or ISO strings with explicit timezone to avoid ambiguity.
API doc
The full API doc can be found here.
Feedback and Questions
You have two options two give feedback or ask questions:
Contributors
Thank you for contributing:
- thetric
- SteveOswald
Feedback
If you have any questions, feel free to open an issue.
