bank-holiday-germany
German bank holidays and public holidays
https://github.com/schoettl/bank-holiday-germany#readme
Version on this page: | 2.0.1.0 |
LTS Haskell 23.18: | 1.3.0.0@rev:4 |
Stackage Nightly 2025-04-19: | 2.1.0.0 |
Latest on Hackage: | 2.1.0.0 |
bank-holiday-germany-2.0.1.0@sha256:2ec3cf31fbed0dd80e730eced674157591a6f81c75f17f078c9810bfdb0378e3,2205
Module documentation for 2.0.1.0
- Data
- Data.Holiday
bank-holiday-germany
See below for a German version.
This package provides calculation of bank holidays and public holidays in Germany.
Most bank holidays are also public aka legal holidays
throughout Germany. You can use isPublicHoliday
to check if a
holiday is also a public holiday.
There are even more public holidays in each federal state.
Public holidays are generally off for all employees. Bank holidays that are not public holidays are generally only off for bank employees.
See the module documentation on Hackage for more information.
Dieses Modul behandelt deutsche Bankfeiertage und gesetzliche Feiertage.
Bis auf Heilig Abend und Silvester sind alle Bankfeiertage
gleichzeitig gesetzliche Feiertage in allen Bundesländern der
Bundesrepublik Deutschland. Die Funktion isPublicHoliday
prüft ob
ein Bankfeiertag auch ein gesetzlicher Feiertag ist.
Darüber hinaus gibt es je nach Bundesland weitere gesetzliche Feiertage.
Für alle 16 Bundesländer sind damit die jeweiligen Feiertage vollständig implementiert (Stand 2024-03-31).
Bankfeiertage sind in der Regel für Bankangestellte frei. Gesetzliche Feiertage sind in der Regel für alle Angestellten frei (im Bundesland für das sie gelten).
Vorsicht: Manche gesetzliche Feiertage gelten nicht für ein ganzes Bundesland sondern nur für bestimmte Landkreise, z.B. das Friedensfest in Augsburg.
Gesetzliche Feiertage sind übrigens Ländersache – abgesehen vom Nationalfeiertag Tag der Deutschen Einheit.
A rewrite to version 2
Sorry for the incompatible changes introduced by the rewrite to version 2.
The rational for the big refactoring was to simplify the library’s
interface by unifying BankHoliday
and ExtraHoliday
types.
How to migrate to version 2
The following functions haven’t changed semantically:
toDay :: Year -> Holiday -> Day
fromDay :: Day -> [Holiday]
holidaysBetween :: Day -> Day -> [(Day, Holiday)]
germanHolidayName :: Holiday -> String
However, they are now returning more holidays – not only bank holidays but the union of all kind of holidays of all federal states.
It’s now on you to filter for the holidays you’re interested in. You can use the following functions:
isBankHoliday :: Holiday -> Bool
isGermanPublicHoliday :: Holiday -> Bool
isFederalPublicHoliday :: FederalState -> Holiday -> Bool
Changes:
isPublicHoliday
has been renamed toisGermanPublicHoliday
.isBankHoliday
now takes aHoliday
instead of aDay
.- The namespace changed from
Data.Time.Calendar.BankHoliday.Germany
toData.Holiday.Germany
. fromDay
now returns a list of holidays instead of aMaybe
.
Why didn’t you get the design right in the first place?
For version 1, I looked on hackage for other holiday packages and there have been two conventions:
bank-holiday-*
with modules likeData.Time.Calendar.BankHoliday.*
*-holidays
with modules likeData.Holiday.*
I settled with the first scheme because I initially only wanted to provide bank holidays and had no plans to support all federal holidays. The library evolved and over time we added support for public holidays and federal holidays. That was when the library’s interface got complicated.
The module path was long, clumsy and inaccurate because it wasn’t only about bank holidays anymore.
Why the mix of english function names and german type constructors?
I choose to use german names for type constructors for simplicity and consistency. It’s hard enough to find a common name and notation for German holidays (e.g. “1. Mai”, “1. Maifeiertag”, “Tag der Arbeit”, etc.). But it’s getting harder to find translations for e.g. “Augsburger Friedensfest” (“Augsburg High Festival of Peace” – source: bavarikon.de – doesn’t sound right).
Also, many German users of this library will have an easier time when they don’t have to look up words like “Whit Monday”, “Ascension Day”, or “Epiphany”.
Sample code for version 2
Rank federal states by number of holidays:
test2.hs
:
import Prelude
import Data.List
import Data.Time
import Data.Holiday.Germany
holidays :: Year -> FederalState -> [(Day, Holiday)]
holidays year state = filter (isFederalPublicHoliday state . snd) $ holidaysBetween start end
where
start = fromGregorian year 1 1
end = fromGregorian year 12 31
supportedFederalStates :: [FederalState]
supportedFederalStates = [minBound .. maxBound]
year :: Year
year = 2025
showPadded :: Int -> String
showPadded n | n < 10 = " " ++ show n
| otherwise = show n
main :: IO ()
main = putStrLn
$ unlines
$ map (\(x, n) -> showPadded n ++ " " ++ show x)
$ sortOn ((0-) . snd)
$ map (\x -> (x, length $ holidays year x))
$ supportedFederalStates
$ stack runghc --package time test2.hs
14 Bayern
12 BadenWuerttemberg
12 Saarland
12 Thueringen
11 MecklenburgVorpommern
11 NordrheinWestfalen
11 RheinlandPfalz
11 Sachsen
11 SachsenAnhalt
10 Berlin
10 Brandenburg
10 Bremen
10 Hamburg
10 Hessen
10 Niedersachsen
10 SchleswigHolstein
More examples:
Sample code for version 1
Rank federal states by number of holidays:
test1.hs
:
import Prelude
import Data.List
import Data.Time
import qualified Data.Time.Calendar.BankHoliday.Germany as BH
import qualified Data.Time.Calendar.BankHoliday.Germany.ExtraHolidays as EH
import Data.Time.Calendar.BankHoliday.Germany (BankHoliday(..))
import Data.Time.Calendar.BankHoliday.Germany.ExtraHolidays (FederalState(..), ExtraHoliday(..))
holidays :: Year -> FederalState -> [Day]
holidays year state = map fst (filter (BH.isPublicHoliday . snd) $ BH.holidaysBetween start end)
++ map fst (EH.holidaysBetween state start end)
where
start = fromGregorian year 1 1
end = fromGregorian year 12 31
supportedFederalStates :: [FederalState]
supportedFederalStates = [minBound .. maxBound]
year :: Year
year = 2024
showPadded :: Int -> String
showPadded n | n < 10 = " " ++ show n
| otherwise = show n
main :: IO ()
main = putStrLn
$ unlines
$ map (\(x, n) -> showPadded n ++ " " ++ show x)
$ sortOn ((0-) . snd)
$ map (\x -> (x, length $ holidays year x))
$ supportedFederalStates
$ stack script --resolver=lts-22.0 --package time --package bank-holiday-germany test1.hs
14 Bayern
12 BadenWuerttemberg
12 Saarland
12 Thueringen
11 MecklenburgVorpommern
11 NordrheinWestfalen
11 RheinlandPfalz
11 Sachsen
11 SachsenAnhalt
10 Berlin
10 Brandenburg
10 Bremen
10 Hamburg
10 Hessen
10 Niedersachsen
10 SchleswigHolstein
More examples:
Changes
Changelog for bank-holiday-germany
The format is based on Keep a Changelog, and this project adheres to the Haskell Package Versioning Policy.
[2.0.1.0] - 2025-04-17
Fixed
- Fronleichnam is a public holiday in some regions of Sachsen. It was missing in this package until now.
[2.0.0.0] - 2025-04-13
Breaking changes due to extensive refactoring!
Fixed
- The Weltkindertag on September 20 is a public holiday in Thüringen (since 2019). It was missing in this package until now.
Changed
- Renamed all type constructors to their German names,
e.g.
Heiligabend
instead ofChristmasEve
. This was changed to be consistent with the formerExtraHoliday
type. - Changed
fromDay
to return a[a]
instead ofMaybe a
because there might be different holidays from different federal states on the same day in future. - Combined modules
Data.Time.Calendar.BankHoliday.Germany
andData.Time.Calendar.BankHoliday.Germany.ExtraHolidays
intoData.Holiday.Germany
. - Combined types
BankHoliday
andExtraHoliday
into new typeHoliday
. - Adapted all functions for new types.
[1.3.1.0] - 2025-04-13
Fixed
- Added missing Weltkindertag for Thüringen (September 20)
[1.3.0.0] - 2024-04-01
Added
- Add extra holidays for all remaining federal states.
- Update doc
[1.2.0.0] - 2024-03-22
Added
- Add extra holidays for Baden-Württemberg, Nordrhein-Westfalen, Hessen, and Niedersachsen
- Update doc
[1.1.0.0] - 2024-03-19
Added
- Add
ExtraHoliday
for Bundesland Berlin - Add and enhance docs
[1.0.0.2] - 2024-03-18
Added
- Add module
ExtraHolidays
for additional public holidays - Export
dayToYear
helper function since it is also used by the new module - Add tests
- Enhance docs
[1.0.0.1] - 2024-03-14
Added
- Added version bounds of dependencies
[1.0.0.0] - 2024-03-14
Initial release