bank-holiday-germany

German bank holidays and public holidays

https://github.com/schoettl/bank-holiday-germany#readme

Version on this page:1.3.0.0
Stackage Nightly 2024-05-03:1.3.0.0@rev:1
Latest on Hackage:1.3.0.0@rev:1

See all snapshots bank-holiday-germany appears in

MIT licensed by Jakob Schöttl
Maintained by [email protected]
This version can be pinned in stack with:bank-holiday-germany-1.3.0.0@sha256:fa130c83bc8cdb833f67c8d01b3ef375a288f00b59e2ab319c3ba30a3b4901e2,2410

Module documentation for 1.3.0.0

Depends on 2 packages(full list with versions):

bank-holiday-germany

See below for a German version.

This package provides calculation of bank holidays and public holidays in Germany.

Most of these bank holidays are also public aka legal holidays throughout Germany. You can use isPublicHoliday to check if a holiday is also a legal holiday.

Legal holidays are generally off for all employees. Bank holidays that are not legal holidays are generally only off for bank employees.

There are even more public holidays in each federal state which are covered by the ExtraHolidays module of this package.

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.

Gesetzliche Feiertage sind Ländersache – abgesehen vom Nationalfeiertag Tag der Deutschen Einheit.

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).

Gesetzliche Feiertage der Bundesländer, die nicht gleichzeitig Bankfeiertage sind, sind im Modul ExtraHolidays definiert.

Für alle 16 Bundesländer sind damit die jeweiligen Feiertage vollständig implementiert (Stand 2024-03-31).

Vorsicht: Manche gesetzliche Feiertage gelten nicht für ein ganzes Bundesland sondern nur für bestimmte Landkreise, z.B. das Friedensfest in Augsburg.

Ein Code-Beispiel im Modul ExtraHolidays zeigt, wie alle Feiertage für ein bestimmtes Bundesland berechnet werden können.

Sample code

Rank federal states by number of holidays:

test.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 test.hs
14  Bayern
12  BadenWuerttemberg
12  Saarland
11  MecklenburgVorpommern
11  NordrheinWestfalen
11  RheinlandPfalz
11  Sachsen
11  SachsenAnhalt
11  Thueringen
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.

[1.0.0.0] - 2024-03-14

Initial release

[1.0.0.1] - 2024-03-14

Added

  • Added version bounds of dependencies

[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.1.0.0] - 2024-03-19

Added

  • Add ExtraHoliday for Bundesland Berlin
  • Add and enhance docs

[1.2.0.0] - 2024-03-22

Added

  • Add extra holidays for Baden-Württemberg, Nordrhein-Westfalen, Hessen, and Niedersachsen
  • Update doc

[1.3.0.0] - 2024-04-01

Added

  • Add extra holidays for all remaining federal states.
  • Update doc