Closed ValentinMeincke closed 1 year ago
I agree, the includingSundays "feature" is misleading. Root for this is, unfortunately, the individial laws of each Bundesland.
For example: by local law the list of "Feiertage" in Brandenburg is more or less what one would expect:
der Neujahrstag (1. Januar), der Karfreitag, der Ostersonntag, der Ostermontag, der 1. Mai (Tag der Arbeit), der Christi Himmelfahrtstag, der Pfingstsonntag, der Pfingstmontag, der Tag der deutschen Einheit (3. Oktober), das Reformationsfest (31. Oktober), der 1. Weihnachtsfeiertag (25. Dezember), der 2. Weihnachtsfeiertag (26. Dezember). https://bravors.brandenburg.de/gesetze/ftg_2015
but for Baden-Württemberg it is:
Neujahr, Erscheinungsfest (6. Januar), Karfreitag, Ostermontag, 1._Mai, Christi Himmelfahrt, Pfingstmontag, Fronleichnam, Allerheiligen (1. November), Erster Weihnachtstag, Zweiter Weihnachtstag https://www.landesrecht-bw.de/jportal/?quelle=jlink&query=FeiertG+BW&psml=bsbawueprod.psml&max=true&aiz=true
As you can see: Easter and Pentecost are no 'Feiertage' there.
Play around with:
go run cmd/feiertage/feiertage.go -region bb 2023
go run cmd/feiertage/feiertage.go -region bb --inklusiveSonntage 2023
go run cmd/feiertage/feiertage.go -region bw 2023
go run cmd/feiertage/feiertage.go -region bw --inklusiveSonntage 2023
This reflects the definition given by the laws on the Bundesland level. So one could say: -includingSundays is there to abstract from that somehow strange, individual definitions by each state. With its default setting it hides every Feiertag, that is a free day anyway, because it is a Sunday. In particular in Brandenburg it might be interested to know if a day is free because it is a Sunday or because it is a Feiertag - even it is a Sunday (maybe only in this year) - when you need to compensate work on this day. The rates might be higher on a Feiertag compared to a standard Sunday.
Today I did not check the definitions/laws for each state again, but it was correct when the library was written. Let me know if you find changes in den NRW law.
If you add the test
checkAndFailRegionFeiertageZahl(t, NordrheinWestfalen(2023,false),10)
to the functionfunc TestFeiertageZahl(t *testing.T)
it fails. It seems that the variable "inklSonntage" for the Regions has no effect on actually including or excluding sundays. Example:Then the output will be:
If we then change
holidays := feiertage.NordrheinWestfalen(2023, true)
toholidays := feiertage.NordrheinWestfalen(2023, false)
we still get the same output which should not be. So the variable mentioned at the beginning seems to have no effect.