I run stundenrechner.online, a set of free German calculators for working hours, Minijob limits and vacation days. The calculator that needed the most care was the one that counts working days between two dates. Germany has 16 federal states, each with its own public holidays, and a few holidays that only apply in some towns. Here is what I ran into, and the small library that came out of it.
Nine holidays everywhere, the rest depends on the state
Nine public holidays apply in every state: New Year, Good Friday, Easter Monday, 1 May, Ascension Day, Whit Monday, German Unity Day and both Christmas days. Everything else is per state. Berlin and Mecklenburg-Vorpommern have International Women's Day on 8 March. Thuringia has World Children's Day on 20 September. Saxony has Buß- und Bettag, which falls on the Wednesday before 23 November, so it moves every year.
The movable holidays all hang off Easter Sunday, so the core of the library is an Easter calculation (the Meeus/Jones/Butcher algorithm) and a list of offsets: Good Friday is Easter minus 2 days, Ascension plus 39, Whit Monday plus 50, Corpus Christi plus 60.
const relative = (days, name) => result.set(isoDate(easter(year) + days * DAY), name); relative(-2, 'Karfreitag'); relative(39, 'Christi Himmelfahrt'); relative(50, 'Pfingstmontag'); Holidays that only apply in some towns
This was the part I almost got wrong. Assumption Day (15 August) is a holiday in Saarland, but in Bavaria only in municipalities with a Catholic majority. Corpus Christi is a holiday in six states, and also in some towns in Saxony and Thuringia. Augsburg has its own holiday on 8 August.
A state-level calculator can't know which town you work in, so these are off by default and you switch them on:
holidays(2027, 'BY'); // no 15 August holidays(2027, 'BY', { assumption: true }); // with 15 August holidays(2027, 'SN', { corpus: true }); // Corpus Christi in Saxony Brandenburg adds a quieter edge case: Easter Sunday and Whit Sunday are listed as public holidays there. That only matters if someone works on Sundays, but if they do, the count is off by two days a year without it.
Do the date maths in UTC
A visitor's browser time zone shouldn't be able to move a date, and local Date objects make that easy to get wrong around the switch to summer time. So every date in the library is a UTC timestamp at midnight, and stepping a day means adding 86,400,000 ms. Without a time zone in play, a day is always exactly that long.
for (let stamp = first; stamp <= last; stamp += DAY) { const date = isoDate(stamp); // 'YYYY-MM-DD' // ... } Count each day once
Users can enter vacation days on top of the holidays. A vacation day that falls on a holiday or on a weekend shouldn't be subtracted twice. The loop checks in a fixed order: is this weekday a working day at all, then is it a holiday, then is it an absence. Only the first match counts. The result also has a per-month breakdown, and a test checks that the months always add up to the yearly total for every state from 2026 to 2030.
The library
I pulled this code out of the site into a single file with no dependencies, under the MIT licence:
github.com/MugheesAhmad/feiertage-bundeslaender
import { workingDays } from './feiertage.js'; workingDays({ start: '2026-01-01', end: '2026-01-31', state: 'NW', absences: new Set(['2026-01-02']), }).remaining; // 20 It covers 2026 to 2030, which is what the calculator needs. If a state changes its holiday law, the file needs an update, so issues and pull requests are welcome.

![Mobility Dynamics Durability and Validation — Ch.14: Integrated Mobility Design Case Studies [KR]](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyhm61u3pzn2io2lf18hg.png)