feiertage

package module
Version: v1.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2020 License: MIT Imports: 4 Imported by: 2

README

Feiertage

Feiertage is a Go/Golang library for calculating German and Austrian bank holidays. It includes the calculation of the date of Easter and, more importantly, offers ways to retrieve public holidays for a state of Germany or Austria (=Bundesland).

The library is probably useful only for people realizing use cases with special requirements inside of Austria or Germany, such as shift schedules or capacity calculation.

Documentation

See https://godoc.org/github.com/wlbr/feiertage

Usage:

There are two types of functions:

  • <feiertag>(year) and
  • <region>(year optional:IncludingSundays:true)

<feiertag> returns an extended time object (type feiertag). It carries the date of the holiday in the requested year plus the name of the holiday. <feiertag> may be any of the following:

Neujahr Epiphanias HeiligeDreiKönige
Valentinstag InternationalerTagDesGedenkensAnDieOpferDesHolocaust Josefitag
Weiberfastnacht Karnevalssonntag Rosenmontag
Fastnacht Aschermittwoch InternationalerFrauentag
Palmsonntag Gründonnerstag Karfreitag
Ostern BeginnSommerzeit Ostermontag
Walpurgisnacht TagDerArbeit TagDerBefreiung
Staatsfeiertag InternationalerTagDerPressefreiheit Florianitag
Muttertag Handtuchtag ChristiHimmelfahrt
Vatertag Pfingsten Pfingstmontag
Dreifaltigkeitssonntag Fronleichnam TagDesMeeres
MariäHimmelfahrt SystemAdministratorAppreciationDay Rupertitag
InternationalerKindertag Weltflüchtlingstag TagDerDeutschenEinheit
TagDerVolksabstimmung Nationalfeiertag Erntedankfest
Reformationstag Halloween BeginnWinterzeit
Allerheiligen Allerseelen Martinstag
Karnevalsbeginn Leopolditag Weltkindertag
BußUndBettag Thanksgiving Blackfriday
Volkstrauertag Nikolaus MariäUnbefleckteEmpfängnis
MariäEmpfängnis Totensonntag ErsterAdvent
ZweiterAdvent DritterAdvent VierterAdvent
Heiligabend Weihnachten Christtag
Stefanitag ZweiterWeihnachtsfeiertag Silvester

<region> returns an object of type region. It offers a list of public holidays valid in the specified state as well as the name and the shortname of the state as attributes. <region> may be any of:

BadenWürttemberg Bayern Berlin
Brandenburg Bremen Hamburg
Hessen MecklenburgVorpommern Niedersachsen
NordrheinWestfalen RheinlandPfalz Saarland
Sachsen SachsenAnhalt SchleswigHolstein
Thüringen Deutschland Burgenland
Kärnten Niederösterreich Oberösterreich
Salzburg Steiermark Tirol
Vorarlberg Wien Österreich
All    

The optional region function argument includingSundays switches the behavior of the region function to include "gesetzliche Feiertage" that fall on Sundays in its output. This is important in Brandenburg, particularly for Easter and Pentecost Sunday. If you are calculating shift costs you will need to know even the holidays "hidden by Sunday".

The region functions return the public holidays ("gesetzliche Feiertage"). The function all returns all defined "special dates", such as Penance Day (Buß- und Bettag) or the begin/end of daylight saving time.

The regional functions for Austrian Bundesländer include saints' days which are state-level holidays, meaning schools etc. are generally closed but workers don't get the day off by default. If you don't want to include these days in your planning, it's okay to reference Österreich instead, as legal holidays are (more or less) synchronised across all Austrian states (Bundesländer).

Examples:
fmt.Println(Ostern(2016))
--> 27.03.2016 Ostern


fmt.Println(BußUndBettag(2016))
--> 16.11.2016 Buß- und Bettag



fmt.Println(Brandenburg(2016))
--> Brandenburg (BB)
    01.01.2016 Neujahr
    25.03.2016 Karfreitag
    27.03.2016 Ostern
    28.03.2016 Ostermontag
    01.05.2016 Tag der Arbeit
    05.05.2016 Christi Himmelfahrt
    15.05.2016 Pfingsten
    16.05.2016 Pfingstmontag
    03.10.2016 Tag der deutschen Einheit
    31.10.2016 Reformationstag
    25.12.2016 Weihnachten
    26.12.2016 Zweiter Weihnachtsfeiertag


fmt.Println(Brandenburg(2016, false))
--> Brandenburg (BB)
    01.01.2016 Neujahr
    25.03.2016 Karfreitag
    28.03.2016 Ostermontag
    01.05.2016 Tag der Arbeit
    05.05.2016 Christi Himmelfahrt
    16.05.2016 Pfingstmontag
    03.10.2016 Tag der deutschen Einheit
    31.10.2016 Reformationstag
    25.12.2016 Weihnachten
    26.12.2016 Zweiter Weihnachtsfeiertag

Command line tool

A little command line tool is included as well. It can be compiled using make buildcmd or go build cmd/feiertage/feiertage.go This will create an executable feiertage.

See https://github.com/wlbr/feiertage/releases/latest for downloads.

Synopsis

feiertage: [options] year

-asTaskjugglerCode (default false)
Print the result as valid source code (`leave x y`) for the Taskjuggler planning tool.
-inklusiveSonntage (default false)
Should public holidays on a Sunday be included?
-region <regionstring> (default "All")
Return public holidays for region ``.
<regionstring> may be (case insensitive, plus some other tricks to make it more tolerant):
 BadenWürttemberg
 Bayern
 Berlin
 Brandenburg
 Bremen
 Hamburg
 Hessen
 MecklenburgVorpommern
 Niedersachsen
 NordrheinWestfalen
 RheinlandPfalz
 Saarland
 Sachsen
 SachsenAnhalt
 SchleswigHolstein
 Thüringen
 Deutschland
 Burgenland
 Kärnten
 Niederösterreich
 Oberösterreich
 Salzburg
 Steiermark
 Tirol
 Vorarlberg
 Wien
 Österreich
 All

Code

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDefaultTimeFormat added in v1.7.0

func SetDefaultTimeFormat(timeformat string)

SetDefaultTimeFormat offers the possibility to change the default format for the ToString function. It defaults to "02.01.2006" The timezone is set at the creation time of the Feiertage object!

func SetDefaultTimeZone added in v1.7.0

func SetDefaultTimeZone(timezone *time.Location)

SetDefaultTimeZone lets you set the timezone of the Feiertag functions. Default ist UTC.

Types

type ByDate

type ByDate []Feiertag

ByDate is the comparator object of Feiertag to be able to sort a list of Feiertage

func (ByDate) Len

func (a ByDate) Len() int

Len is the sort criteria for Feiertage

func (ByDate) Less

func (a ByDate) Less(i, j int) bool

Less is a comparator for Feiertage sorting.

func (ByDate) Swap

func (a ByDate) Swap(i, j int)

Swap exchanges two Feiertage within an array.

type Feiertag

type Feiertag struct {
	time.Time
	Text string
}

Feiertag is an extented Time object. You may use it like any Time, but it offers an additional attribute carrying the name of the Feiertag.

func Allerheiligen

func Allerheiligen(x int) Feiertag

Allerheiligen is All Saints' Day or Allhallows, a fixed date

func Allerseelen

func Allerseelen(x int) Feiertag

Allerseelen is All Souls' Day, the day after All Saints' Day,

func Aschermittwoch

func Aschermittwoch(x int) Feiertag

Aschermittwoch is Ash Wednesday, 46 days before Easter.

func BeginnSommerzeit

func BeginnSommerzeit(x int) Feiertag

BeginnSommerzeit is the start of daylight saving time. Last Sunday of March.

func BeginnWinterzeit

func BeginnWinterzeit(x int) Feiertag

BeginnWinterzeit is the end of daylight saving time. Last Sunday of October.

func Blackfriday

func Blackfriday(x int) Feiertag

Blackfriday is the Friday after Thanksgiving.

func BußUndBettag

func BußUndBettag(x int) Feiertag

BußUndBettag is Penance Day, 11 days before the first Sunday in Advent

func ChristiHimmelfahrt

func ChristiHimmelfahrt(x int) Feiertag

ChristiHimmelfahrt is Ascension Day, 39 days after Easter, therefore always a Thursday.

func Christtag

func Christtag(x int) Feiertag

Christtag is Christmas is in Austria.

func Dreifaltigkeitssonntag

func Dreifaltigkeitssonntag(x int) Feiertag

Dreifaltigkeitssonntag is Trinity Sunday, the Sunday after Pentecost

func DritterAdvent

func DritterAdvent(x int) Feiertag

DritterAdvent is the third Sunday in Advent

func Epiphanias

func Epiphanias(x int) Feiertag

Epiphanias is Epiphany, a fixed date.

func Erntedankfest

func Erntedankfest(x int) Feiertag

Erntedankfest is Thanksgiving or Harvest Festival, the first Sunday of October. The german Erntedankfest is not the same than the US Thanksgiving.

func ErsterAdvent

func ErsterAdvent(x int) Feiertag

ErsterAdvent is the first Sunday in Advent

func Fastnacht

func Fastnacht(x int) Feiertag

Fastnacht is shrovetide, the Tuesday of carnival, 47 days before Easter.

func Florianitag

func Florianitag(x int) Feiertag

Florianitag is St Florian's Day, a fixed date.

func Fronleichnam

func Fronleichnam(x int) Feiertag

Fronleichnam is Corpus Christi, 60 days after Eastern, therefore always a Thursday.

func Gründonnerstag

func Gründonnerstag(x int) Feiertag

Gründonnerstag is Holy Thursday or Maundy Thursday, the last Thursday before Eastern

func Halloween

func Halloween(x int) Feiertag

Halloween is a fixed date.

func Handtuchtag added in v1.9.0

func Handtuchtag(x int) Feiertag

Handtuchtag is Towel Day, May 25. It is celebrated as a tribute to the author Douglas Adams by his fans.

func Heiligabend

func Heiligabend(x int) Feiertag

Heiligabend is Christmas Eve, the last day before Christmas.

func HeiligeDreiKönige

func HeiligeDreiKönige(x int) Feiertag

HeiligeDreiKönige is another name for Epiphany, a fixed date.

func InternationalerFrauentag added in v1.6.1

func InternationalerFrauentag(x int) Feiertag

InternationalerFrauentag is International Women's Day, a fixed date.

func InternationalerKindertag added in v1.6.1

func InternationalerKindertag(x int) Feiertag

InternationalerKindertag is special to Germany and Austrian and isnot the same as Weltkindertag (World Children's Day), a fixed date.

func InternationalerTagDerPressefreiheit added in v1.6.1

func InternationalerTagDerPressefreiheit(x int) Feiertag

InternationalerTagDerPressefreiheit is World Press Freedom Day, a fixed date.

func InternationalerTagDesGedenkensAnDieOpferDesHolocaust added in v1.6.1

func InternationalerTagDesGedenkensAnDieOpferDesHolocaust(x int) Feiertag

InternationalerTagDesGedenkensAnDieOpferDesHolocaust is (International Holocaust Remembrance Day, a fixed date.

func Josefitag

func Josefitag(x int) Feiertag

Josefitag is St Joseph's Day, a fixed date.

func Karfreitag

func Karfreitag(x int) Feiertag

Karfreitag is Good Friday, the last Friday before Easter

func Karnevalsbeginn

func Karnevalsbeginn(x int) Feiertag

Karnevalsbeginn is the beginning of carnival, a fixed date.

func Karnevalssonntag

func Karnevalssonntag(x int) Feiertag

Karnevalssonntag is the sunday of carnival, 49 days before Easter.

func Leopolditag

func Leopolditag(x int) Feiertag

Leopolditag is St Leopold's Day, a fixed date.

func MariäEmpfängnis

func MariäEmpfängnis(x int) Feiertag

MariäEmpfängnis has a shorter name for MariäUnbefleckteEmpfängnis in Austria.

func MariäHimmelfahrt

func MariäHimmelfahrt(x int) Feiertag

MariäHimmelfahrt is Assumption Day, a fixed date.

func MariäUnbefleckteEmpfängnis

func MariäUnbefleckteEmpfängnis(x int) Feiertag

MariäUnbefleckteEmpfängnis is Day of Immaculate Conception, a fixed date.

func Martinstag

func Martinstag(x int) Feiertag

Martinstag or Skt. Martin is Martinmas, a fixed date

func Muttertag

func Muttertag(x int) Feiertag

Muttertag is Mother's Day oder Mothering Sunday, the second Sunday in May.

func Nationalfeiertag

func Nationalfeiertag(x int) Feiertag

Nationalfeiertag is the Austrian national day, a fixed date.

func Neujahr

func Neujahr(x int) Feiertag

Neujahr is NewYear, a fixed date.

func Nikolaus

func Nikolaus(x int) Feiertag

Nikolaus is St Nicholas' Day, a fixed date

func Ostermontag

func Ostermontag(x int) Feiertag

Ostermontag is Easter Monday, the Monday after Easter.

func Ostern

func Ostern(x int) Feiertag

Ostern is Easter. Calculated by an extended Gauss algorithm.

func Palmsonntag

func Palmsonntag(x int) Feiertag

Palmsonntag is Palm Sunday , the last Sunday before Easter

func Pfingsten

func Pfingsten(x int) Feiertag

Pfingsten is Pentecost, 49 days after Easter.

func Pfingstmontag

func Pfingstmontag(x int) Feiertag

Pfingstmontag is Whit Monday, the monday after Pentecost.

func Reformationstag

func Reformationstag(x int) Feiertag

Reformationstag is Reformation Day, a fixed date.

func Rosenmontag

func Rosenmontag(x int) Feiertag

Rosenmontag is the monday of carnival, 48 days before Easter.

func Rupertitag

func Rupertitag(x int) Feiertag

Rupertitag is St Rupert's Day, a fixed date.

func Silvester

func Silvester(x int) Feiertag

Silvester is NewYearsEve, a fixed date.

func Staatsfeiertag

func Staatsfeiertag(x int) Feiertag

Staatsfeiertag is May 1st in Austria, a fixed date.

func Stefanitag

func Stefanitag(x int) Feiertag

Stefanitag is December 26th in Austria.

func SystemAdministratorAppreciationDay added in v1.9.0

func SystemAdministratorAppreciationDay(x int) Feiertag

SystemAdministratorAppreciationDay is the last Fridy in July

func TagDerArbeit

func TagDerArbeit(x int) Feiertag

TagDerArbeit is Labour Day, a fixed date.

func TagDerBefreiung

func TagDerBefreiung(x int) Feiertag

TagDerBefreiung is Victory in Europe Day, a fixed date.

func TagDerDeutschenEinheit

func TagDerDeutschenEinheit(x int) Feiertag

TagDerDeutschenEinheit is German Unity Day, a fixed date.

func TagDerVolksabstimmung

func TagDerVolksabstimmung(x int) Feiertag

TagDerVolksabstimmung is Referendum Day in Carinthia, a fixed date.

func TagDesMeeres added in v1.6.1

func TagDesMeeres(x int) Feiertag

TagDesMeeres is World Oceans Day, a fixed date.

func Thanksgiving

func Thanksgiving(x int) Feiertag

Thanksgiving in the US, the fourth Thursday of November.

func Totensonntag

func Totensonntag(x int) Feiertag

Totensonntag is Sunday in commemoration of the dead, the last Sunday before the fourth Sunday in Advent

func TowelDay added in v1.9.0

func TowelDay(x int) Feiertag

TowelDay is, May 25. It is celebrated as a tribute to the author Douglas Adams by his fans.

func Valentinstag

func Valentinstag(x int) Feiertag

Valentinstag is Valentine's Day, a fixed date.

func Vatertag

func Vatertag(x int) Feiertag

Vatertag is Father's Day, same day a Ascension Day, 39 days after Easter, therefore always a Thursday.

func VierterAdvent

func VierterAdvent(x int) Feiertag

VierterAdvent is the fourth Sunday in Advent

func Volkstrauertag

func Volkstrauertag(x int) Feiertag

Volkstrauertag is Remembrance Sunday, the second sunday before the first Sunday in Advent

func Walpurgisnacht

func Walpurgisnacht(x int) Feiertag

Walpurgisnacht is Walpurgis Night, a fixed date.

func Weiberfastnacht

func Weiberfastnacht(x int) Feiertag

Weiberfastnacht is a part of carnival, 52 days before Easter.

func Weihnachten

func Weihnachten(x int) Feiertag

Weihnachten is Christmas, a fixed date

func Weltflüchtlingstag added in v1.6.1

func Weltflüchtlingstag(x int) Feiertag

Weltflüchtlingstag is World Refugee Day, a fixed date.

func Weltkindertag added in v1.6.1

func Weltkindertag(x int) Feiertag

Weltkindertag is World Children's Day, a fixed date.

func ZweiterAdvent

func ZweiterAdvent(x int) Feiertag

ZweiterAdvent is the second Sunday in Advent

func ZweiterWeihnachtsfeiertag

func ZweiterWeihnachtsfeiertag(x int) Feiertag

ZweiterWeihnachtsfeiertag is day after Christmas, a fixed date

func (Feiertag) String

func (f Feiertag) String() string

The String function of Feiertag will print its concrete Time (Date) plus the name of the Feiertag.

type Region

type Region struct {
	Name      string
	Shortname string
	Feiertage []Feiertag
}

Region represents a Federal State of Germany or Austria (Bundesland). Some public holidays are common throughout the whole country, while others depend on the Bundesland. Short names of Austrian states are as suggested in ÖNORM A 1080.

func All

func All(y int, inklSonntage ...bool) Region

All returns a Region object holding all public holidays/feast days known to this program. Not all of them are public holidays (basically 'work free' days).

func BadenWürttemberg

func BadenWürttemberg(y int, inklSonntage ...bool) Region

BadenWürttemberg returns a Region object holding all public holidays in the state Baden-Württemberg

func Bayern

func Bayern(y int, inklSonntage ...bool) Region

Bayern returns a Region object holding all public holidays in the state Bayern

func Berlin

func Berlin(y int, inklSonntage ...bool) Region

Berlin returns a Region object holding all public holidays in the state Berlin

func Brandenburg

func Brandenburg(y int, inklSonntage ...bool) Region

Brandenburg returns a Region object holding all public holidays in the state Brandenburg

func Bremen

func Bremen(y int, inklSonntage ...bool) Region

Bremen returns a Region object holding all public holidays in the state Bremen

func Burgenland

func Burgenland(y int, inklSonntage ...bool) Region

Burgenland returns a Region object holding all public holidays in the state of Burgenland.

func Deutschland

func Deutschland(y int, inklSonntage ...bool) Region

Deutschland returns a Region object holding all public holidays that are Common in Germany

func GetAllRegions added in v1.8.0

func GetAllRegions(year int, inklSonntag bool, country ...string) (regions []Region)

GetAllRegions returns a list of all regions available. These may be filtered by providing the country ("de"|"at"|empty)

func Hamburg

func Hamburg(y int, inklSonntage ...bool) Region

Hamburg returns a Region object holding all public holidays in the state Hamburg

func Hessen

func Hessen(y int, inklSonntage ...bool) Region

Hessen returns a Region object holding all public holidays in the state Hessen

func Kärnten

func Kärnten(y int, inklSonntage ...bool) Region

Kärnten returns a Region object holding all public holidays in the state of Kärnten.

func MecklenburgVorpommern

func MecklenburgVorpommern(y int, inklSonntage ...bool) Region

MecklenburgVorpommern returns a Region object holding all public holidays in the state Mecklenburg-Vorpommern

func Niedersachsen

func Niedersachsen(y int, inklSonntage ...bool) Region

Niedersachsen returns a Region object holding all public holidays in the state Niedersachsen

func Niederösterreich

func Niederösterreich(y int, inklSonntage ...bool) Region

Niederösterreich returns a Region object holding all public holidays in the state of Niederösterreich.

func NordrheinWestfalen

func NordrheinWestfalen(y int, inklSonntage ...bool) Region

NordrheinWestfalen returns a Region object holding all public holidays in the state Nordrhein-Westfalen

func Oberösterreich

func Oberösterreich(y int, inklSonntage ...bool) Region

Oberösterreich returns a Region object holding all public holidays in the state of Oberösterreich.

func RheinlandPfalz

func RheinlandPfalz(y int, inklSonntage ...bool) Region

RheinlandPfalz returns a Region object holding all public holidays in the state Rheinland-Pfalz

func Saarland

func Saarland(y int, inklSonntage ...bool) Region

Saarland returns a Region object holding all public holidays in the state Saarland

func Sachsen

func Sachsen(y int, inklSonntage ...bool) Region

Sachsen returns a Region object holding all public holidays in the state Sachsen

func SachsenAnhalt

func SachsenAnhalt(y int, inklSonntage ...bool) Region

SachsenAnhalt returns a Region object holding all public holidays in the state SachsenAnhalt

func Salzburg

func Salzburg(y int, inklSonntage ...bool) Region

Salzburg returns a Region object holding all public holidays in the state of Salzburg.

func SchleswigHolstein

func SchleswigHolstein(y int, inklSonntage ...bool) Region

SchleswigHolstein returns a Region object holding all public holidays in the state SchleswigHolstein

func Steiermark

func Steiermark(y int, inklSonntage ...bool) Region

Steiermark returns a Region object holding all public holidays in the state of Steiermark.

func Thüringen

func Thüringen(y int, inklSonntage ...bool) Region

Thüringen returns a Region object holding all public holidays in the state Thüringen

func Tirol

func Tirol(y int, inklSonntage ...bool) Region

Tirol returns a Region object holding all public holidays in the state of Tirol.

func Vorarlberg

func Vorarlberg(y int, inklSonntage ...bool) Region

Vorarlberg returns a Region object holding all public holidays in the state of Vorarlberg.

func Wien

func Wien(y int, inklSonntage ...bool) Region

Wien returns a Region object holding all public holidays in the city and state of Vienna.

func Österreich

func Österreich(y int, inklSonntage ...bool) Region

Österreich returns a Region object holding all public holidays that are common in Austria.

func (Region) String

func (r Region) String() string

String returns a String containing the name and Shortname of the region and the list of public holidays (objects of type Feiertage).

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL