Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
This module computes general bank holidays.
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.
Note: There are even more public holidays in each federal state which are not covered by this module.
Synopsis
- data BankHoliday
- isBankHoliday :: Day -> Bool
- isPublicHoliday :: BankHoliday -> Bool
- calculateEasterSunday :: Year -> Day
- holidaysBetween :: Day -> Day -> [(Day, BankHoliday)]
- fromDay :: Day -> Maybe BankHoliday
- toDay :: Year -> BankHoliday -> Day
- germanHolidayName :: BankHoliday -> String
Documentation
data BankHoliday Source #
Data type specifying German bank holidays.
Note: This type cannot be an instance of class Ord
because due to
Easter day calculation the order can change from year to year.
NewYearsDay | |
GoodFriday | Karfreitag |
EasterMonday | |
LabourDay | |
AscensionDay | Christi Himmelfahrt |
WhitMonday | Pfingstmontag |
GermanUnityDay | |
ChristmasEve | |
ChristmasDay | |
SecondChristmasDay | |
NewYearsEve |
Instances
isBankHoliday :: Day -> Bool Source #
Check if a given day is a BankHoliday
.
>>>
isBankHoliday (fromGregorian 2024 1 1)
True
isPublicHoliday :: BankHoliday -> Bool Source #
True only for German public holidays aka legal holidays. Chrismas Eve and New Year's Eve are bank holidays but not public holidays.
calculateEasterSunday :: Year -> Day Source #
Calculate Easter Sunday using Spencer's algorithm.
holidaysBetween :: Day -> Day -> [(Day, BankHoliday)] Source #
Compute pairs of date and holiday from start to end.
>>>
map snd $ holidaysBetween (fromGregorian 2024 12 25) (fromGregorian 2024 12 26)
[ChristmasDay,SecondChristmasDay]
fromDay :: Day -> Maybe BankHoliday Source #
Compute Maybe
the holiday for a given date.
>>>
fromDay (fromGregorian 2024 1 1)
Just NewYearsDay
>>>
fromDay (fromGregorian 2024 5 5)
Nothing
toDay :: Year -> BankHoliday -> Day Source #
Compute the date for a given year and bank holiday.
>>>
toDay 2024 LabourDay
2024-05-01
germanHolidayName :: BankHoliday -> String Source #
Translate the holiday name to German.