Repository: vacanza/python-holidays

Issue:
Update Denmark holidays
I've received an email with a link to https://www.norden.org/en/info-norden/public-holidays-denmark

The author complained about absence of June 5th in the list of holiday dates:

> The calendar for Denmark does not include 5 June.

Denmark holidays need to be extended using categories approach.


Discussion:

Resolving patch:
diff --git a/holidays/countries/denmark.py b/holidays/countries/denmark.py
--- a/holidays/countries/denmark.py
+++ b/holidays/countries/denmark.py
@@ -12,6 +12,7 @@
 from datetime import timedelta as td
 from gettext import gettext as tr
 
+from holidays.constants import OPTIONAL, PUBLIC
 from holidays.groups import ChristianHolidays, InternationalHolidays
 from holidays.holiday_base import HolidayBase
 
@@ -22,11 +23,13 @@ class Denmark(HolidayBase, ChristianHolidays, InternationalHolidays):
 
     References:
     - https://en.wikipedia.org/wiki/Public_holidays_in_Denmark
+    - https://www.norden.org/en/info-norden/public-holidays-denmark
     - https://www.ft.dk/samling/20222/lovforslag/l13/index.htm
     """
 
     country = "DK"
     default_language = "da"
+    supported_categories = {OPTIONAL, PUBLIC}
     supported_languages = ("da", "en_US", "uk")
 
     def __init__(self, *args, **kwargs):
@@ -34,9 +37,7 @@ def __init__(self, *args, **kwargs):
         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("Nytårsdag"))
 
@@ -53,7 +54,7 @@ def _populate(self, year):
         self._add_easter_monday(tr("Anden påskedag"))
 
         # See https://www.ft.dk/samling/20222/lovforslag/l13/index.htm
-        if year <= 2023:
+        if self._year <= 2023:
             # Great Day of Prayers.
             self._add_holiday(tr("Store bededag"), self._easter_sunday + td(days=+26))
 
@@ -72,6 +73,19 @@ def _populate(self, year):
         # Second Day of Christmas.
         self._add_christmas_day_two(tr("Anden juledag"))
 
+    def _populate_optional_holidays(self):
+        # International Workers' Day.
+        self._add_labor_day(tr("Arbejdernes kampdag"))
+
+        # Constitution Day.
+        self._add_holiday_jun_5(tr("Grundlovsdag"))
+
+        # Christmas Eve.
+        self._add_christmas_eve(tr("Juleaftensdag"))
+
+        # New Year's Eve.
+        self._add_new_years_eve(tr("Nytårsaften"))
+
 
 class DK(Denmark):
     pass


Test patch:
diff --git a/tests/countries/test_denmark.py b/tests/countries/test_denmark.py
--- a/tests/countries/test_denmark.py
+++ b/tests/countries/test_denmark.py
@@ -9,6 +9,7 @@
 #  Website: https://github.com/dr-prodigy/python-holidays
 #  License: MIT (see LICENSE file)
 
+from holidays.constants import OPTIONAL
 from holidays.countries.denmark import Denmark, DK, DNK
 from tests.common import TestCase
 
@@ -52,6 +53,15 @@ def test_2022(self):
             ("2022-12-26", "Anden juledag"),
         )
 
+    def test_2022_optional(self):
+        self.assertHolidays(
+            Denmark(categories=OPTIONAL, years=2022),
+            ("2022-05-01", "Arbejdernes kampdag"),
+            ("2022-06-05", "Grundlovsdag"),
+            ("2022-12-24", "Juleaftensdag"),
+            ("2022-12-31", "Nytårsaften"),
+        )
+
     def test_2024(self):
         # https://www.officeholidays.com/countries/denmark/2024
         self.assertNoHoliday("2024-04-26")
@@ -64,12 +74,15 @@ def test_l10n_default(self):
             ("2022-04-15", "Langfredag"),
             ("2022-04-17", "Påskedag"),
             ("2022-04-18", "Anden påskedag"),
+            ("2022-05-01", "Arbejdernes kampdag"),
             ("2022-05-13", "Store bededag"),
             ("2022-05-26", "Kristi himmelfartsdag"),
-            ("2022-06-05", "Pinsedag"),
+            ("2022-06-05", "Grundlovsdag; Pinsedag"),
             ("2022-06-06", "Anden pinsedag"),
+            ("2022-12-24", "Juleaftensdag"),
             ("2022-12-25", "Juledag"),
             ("2022-12-26", "Anden juledag"),
+            ("2022-12-31", "Nytårsaften"),
         )
 
     def test_l10n_en_us(self):
@@ -80,12 +93,15 @@ def test_l10n_en_us(self):
             ("2022-04-15", "Good Friday"),
             ("2022-04-17", "Easter Sunday"),
             ("2022-04-18", "Easter Monday"),
+            ("2022-05-01", "International Workers' Day"),
             ("2022-05-13", "Great Prayer Day"),
             ("2022-05-26", "Ascension Day"),
-            ("2022-06-05", "Whit Sunday"),
+            ("2022-06-05", "Constitution Day; Whit Sunday"),
             ("2022-06-06", "Whit Monday"),
+            ("2022-12-24", "Christmas Eve"),
             ("2022-12-25", "Christmas Day"),
             ("2022-12-26", "Second Day of Christmas"),
+            ("2022-12-31", "New Year's Eve"),
         )
 
     def test_l10n_uk(self):
@@ -96,10 +112,13 @@ def test_l10n_uk(self):
             ("2022-04-15", "Страсна пʼятниця"),
             ("2022-04-17", "Великдень"),
             ("2022-04-18", "Великодній понеділок"),
+            ("2022-05-01", "День праці"),
             ("2022-05-13", "День загальної молитви"),
             ("2022-05-26", "Вознесіння Господнє"),
-            ("2022-06-05", "Трійця"),
+            ("2022-06-05", "День Конституції; Трійця"),
             ("2022-06-06", "День Святого Духа"),
+            ("2022-12-24", "Святий вечір"),
             ("2022-12-25", "Різдво Христове"),
             ("2022-12-26", "Другий день Різдва"),
+            ("2022-12-31", "Переддень Нового року"),
         )