feiertage package

Module contents

class feiertage.Holidays(state: str, year: int = 2025, regional: bool = False, school_free: bool = False)

Bases: object

Parameters:
  • state (str) –

    The state code for the federal state for which the holidays should be calculated. This parameter can either be the name of the state or a short state code, p.Ex. ‘Baden-Württemberg’ and ‘BW’ would both be a valid option. Furthermore the option ‘Deutschland’ / ‘DE’ gives a list of only the holidays which all the federal states commonly share. The list of all the valid state codes is stored in the dictionary feiertage.states:

    • ’Deutschland’ / ‘DE’,

    • ’Baden-Württemberg’ / ‘BW’,

    • ’Bayern’ / ‘BY’,

    • ’Berlin’ / ‘BE’,

    • ’Brandenburg’ / ‘BB’,

    • ’Bremen’ / ‘HB’,

    • ’Hamburg’ / ‘HH’,

    • ’Hessen’ / ‘HE’,

    • ’Mecklenburg-Vorpommern’ / ‘MV’,

    • ’Niedersachsen’ / ‘NI’,

    • ’Nordrhein-Westfalen’ / ‘NW’,

    • ’Rheinland-Pfalz’ / ‘RP’,

    • ’Saarland’ / ‘SL’,

    • ’Sachsen’ / ‘SN’,

    • ’Sachsen-Anhalt’ / ‘ST’,

    • ’Schleswig-Holstein’ / ‘SH’,

    • ’Thüringen’ / ‘TH’,

  • year (int, optional) – the year for which the holidays should be calculated

  • regional (boolean, default=False) –

    Optionally enable some regional holidays which are only valid in some communities. These would be the following ones:

    • Fronleichnam in SL and TH

    • Augsburger Hohes Friedensfest in BY

    • Mariä Himmelfahrt in BY

  • school_free (boolean, default=False) –

    Optionally enable some days which are not holidays but there is no school. These would be the following ones:

    • Gründonnerstag in BW

    • Reformationstag in BW

    • Buß- und Bettag in BY

get_holidays_list() list

Get a list of only the dates for all holidays stored in a datetime.date object

Returns:

holidays – Each entry in this list is a date object which points to a holiday

Return type:

list of datetime.date objects

Submodules

feiertage.easter module

feiertage.easter.calc_easter(year: int) date

Calculates the date of easter.

The calculation of the Easter Sunday by following the formula by Karl Friedrich Gauss. A Detailed description can be read on the following website: https://de.wikipedia.org/wiki/Gau%C3%9Fsche_Osterformel

Args:

yearint

The year for which the date of Easter should be calculated

Returns:

easter_daydate

A datetime object which is set to the date of easter

Examples:

>>> from feiertage import easter
>>> easter.calc_easter(2023)    # example year: 2023
datetime.date(2023,4,9)