Skip to content

Commit

Permalink
Merge branch 'beta' into subdivision-aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
arkid15r authored Feb 12, 2024
2 parents 6e85ec6 + be26ebf commit 8a0004a
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 262 deletions.
50 changes: 27 additions & 23 deletions holidays/countries/ireland.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,33 @@
# Website: https://github.com/dr-prodigy/python-holidays
# License: MIT (see LICENSE file)

from holidays.calendars.gregorian import FEB, MAR
from holidays.calendars.gregorian import FEB, MAR, SEP, DEC
from holidays.groups import ChristianHolidays, InternationalHolidays, StaticHolidays
from holidays.observed_holiday_base import (
ObservedHolidayBase,
SAT_SUN_TO_NEXT_MON,
SAT_SUN_TO_NEXT_MON_TUE,
)
from holidays.holiday_base import HolidayBase


class Ireland(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, StaticHolidays):
class Ireland(HolidayBase, ChristianHolidays, InternationalHolidays, StaticHolidays):
"""
Official holidays in Ireland, as declared in the Citizen's Information
bulletin:
https://www.citizensinformation.ie/en/employment/employment_rights_and_conditions/leave_and_holidays/public_holidays_in_ireland.html
References:
- https://en.wikipedia.org/wiki/Public_holidays_in_the_Republic_of_Ireland
- https://www.citizensinformation.ie/en/employment/employment_rights_and_conditions/leave_and_holidays/public_holidays_in_ireland.html # noqa: E501
"""

country = "IE"
observed_label = "%s (observed)"

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self)
InternationalHolidays.__init__(self)
StaticHolidays.__init__(self, IrelandStaticHolidays)
kwargs.setdefault("observed_rule", SAT_SUN_TO_NEXT_MON)
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
if self._year <= 1871:
return None

# New Year's Day.
self._add_new_years_day("New Year's Day")
if self._year >= 1975:
self._add_new_years_day("New Year's Day")

# St. Brigid's Day.
if self._year >= 2023:
Expand All @@ -48,35 +46,39 @@ def _populate_public_holidays(self):
self._add_holiday_1st_mon_from_feb_1(name)

# St. Patrick's Day.
self._add_observed(self._add_holiday_mar_17("St. Patrick's Day"))
if self._year >= 1903:
self._add_holiday_mar_17("St. Patrick's Day")

# Easter Monday.
self._add_easter_monday("Easter Monday")

# May Day.
if self._year >= 1978:
if self._year >= 1994:
name = "May Day"
if self._year == 1995:
self._add_holiday_may_8(name)
else:
self._add_holiday_1st_mon_of_may(name)

# June Bank holiday.
self._add_holiday_1st_mon_of_jun("June Bank Holiday")
if self._year >= 1973:
# June Bank Holiday.
self._add_holiday_1st_mon_of_jun("June Bank Holiday")
else:
# Whit Monday.
self._add_whit_monday("Whit Monday")

# Summer Bank holiday.
# August Bank Holiday.
self._add_holiday_1st_mon_of_aug("August Bank Holiday")

# October Bank Holiday.
self._add_holiday_last_mon_of_oct("October Bank Holiday")
if self._year >= 1977:
self._add_holiday_last_mon_of_oct("October Bank Holiday")

# Christmas Day.
self._add_observed(self._add_christmas_day("Christmas Day"))
self._add_christmas_day("Christmas Day")

# St. Stephen's Day.
self._add_observed(
self._add_christmas_day_two("St. Stephen's Day"), rule=SAT_SUN_TO_NEXT_MON_TUE
)
self._add_christmas_day_two("St. Stephen's Day")


class IE(Ireland):
Expand All @@ -89,5 +91,7 @@ class IRL(Ireland):

class IrelandStaticHolidays:
special_public_holidays = {
1999: (DEC, 31, "Millennium Celebrations"),
2011: (SEP, 14, "National Day of Mourning"),
2022: (MAR, 18, "Day of Remembrance and Recognition"),
}
Loading

0 comments on commit 8a0004a

Please sign in to comment.