Skip to content

Commit

Permalink
Update Netherlands holidays: add holiday categories (#1552)
Browse files Browse the repository at this point in the history
Co-authored-by: Arkadii Yakovets <ark@cho.red>
  • Loading branch information
KJhellico and arkid15r committed Nov 13, 2023
1 parent 3188346 commit 85c0f35
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 35 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ The list of supported countries, their subdivisions, supported languages and cat
- NL
-
- en_US, **nl**, uk
-
- OPTIONAL, **PUBLIC**
* - New Zealand
- NZ
- Regions: AUK, BOP, CAN, CIT, GIS, HKB, MBH, MWT, NSN, NTL, OTA, STL, TAS, TKI, WGN, WKO, WTC
Expand Down
44 changes: 24 additions & 20 deletions holidays/countries/netherlands.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,63 +14,59 @@
from gettext import gettext as tr

from holidays.calendars.gregorian import APR, AUG
from holidays.constants import OPTIONAL, PUBLIC
from holidays.groups import ChristianHolidays, InternationalHolidays
from holidays.holiday_base import HolidayBase


class Netherlands(HolidayBase, ChristianHolidays, InternationalHolidays):
"""
https://en.wikipedia.org/wiki/Public_holidays_in_the_Netherlands
http://www.iamsterdam.com/en/plan-your-trip/practical-info/public-holidays
References:
- https://en.wikipedia.org/wiki/Public_holidays_in_the_Netherlands
- https://nl.wikipedia.org/wiki/Feestdagen_in_Nederland
- http://www.iamsterdam.com/en/plan-your-trip/practical-info/public-holidays
"""

country = "NL"
default_language = "nl"
supported_categories = {OPTIONAL, PUBLIC}
supported_languages = ("en_US", "nl", "uk")

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self)
InternationalHolidays.__init__(self)
super().__init__(*args, **kwargs)

def _populate(self, year):
super()._populate(year)

def _populate_public_holidays(self):
# New Year's Day.
self._add_new_years_day(tr("Nieuwjaarsdag"))

# Good Friday.
self._add_good_friday(tr("Goede Vrijdag"))

# Easter Sunday.
self._add_easter_sunday(tr("Eerste paasdag"))

# Easter Monday.
self._add_easter_monday(tr("Tweede paasdag"))

# King's / Queen's day
if year >= 1891:
if self._year >= 1891:
name = (
# King's Day.
tr("Koningsdag")
if year >= 2014
if self._year >= 2014
# Queen's Day.
else tr("Koninginnedag")
)
if year >= 2014:
dt = date(year, APR, 27)
elif year >= 1949:
dt = date(year, APR, 30)
if self._year >= 2014:
dt = date(self._year, APR, 27)
elif self._year >= 1949:
dt = date(self._year, APR, 30)
else:
dt = date(year, AUG, 31)
dt = date(self._year, AUG, 31)
if self._is_sunday(dt):
dt += td(days=-1) if year >= 1980 else td(days=+1)
dt += td(days=-1) if self._year >= 1980 else td(days=+1)
self._add_holiday(name, dt)

if year >= 1945 and year % 5 == 0:
# Liberation Day.
self._add_holiday_may_5(tr("Bevrijdingsdag"))

# Ascension Day.
self._add_ascension_thursday(tr("Hemelvaartsdag"))

Expand All @@ -86,6 +82,14 @@ def _populate(self, year):
# Second Day of Christmas.
self._add_christmas_day_two(tr("Tweede Kerstdag"))

def _populate_optional_holidays(self):
# Good Friday.
self._add_good_friday(tr("Goede Vrijdag"))

if (self._year >= 1945 and self._year % 5 == 0) or self._year >= 1990:
# Liberation Day.
self._add_holiday_may_5(tr("Bevrijdingsdag"))


class NL(Netherlands):
pass
Expand Down

0 comments on commit 85c0f35

Please sign in to comment.