Skip to content

Commit

Permalink
Update Dominican Republic holidays: fix Restoration Day (#1965)
Browse files Browse the repository at this point in the history
Co-authored-by: Arkadii Yakovets <[email protected]>
  • Loading branch information
KJhellico and arkid15r committed Aug 30, 2024
1 parent 0359e5a commit 6ec8d56
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 603 deletions.
19 changes: 7 additions & 12 deletions holidays/countries/dominican_republic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
# Website: https://github.com/vacanza/python-holidays
# License: MIT (see LICENSE file)

from datetime import date
from gettext import gettext as tr

from holidays.calendars.gregorian import JUN
from holidays.groups import ChristianHolidays, InternationalHolidays
from holidays.observed_holiday_base import (
ObservedHolidayBase,
Expand All @@ -39,11 +37,11 @@ def __init__(self, *args, **kwargs):
kwargs.setdefault("observed_rule", TUE_WED_TO_PREV_MON + THU_FRI_TO_NEXT_MON)
super().__init__(*args, **kwargs)

def _is_observed(self, dt: date) -> bool:
# Law No. 139-97 - Holidays Dominican Republic - Jun 27, 1997
return dt >= date(1997, JUN, 27)

def _populate_public_holidays(self):
# Law No. 139-97 - Holidays Dominican Republic (Jun 27, 1997).
if self._year <= 1997:
return None

# New Year's Day.
self._add_new_years_day(tr("Año Nuevo"))

Expand Down Expand Up @@ -72,12 +70,9 @@ def _populate_public_holidays(self):
self._add_corpus_christi_day(tr("Corpus Christi"))

# Restoration Day.
name = tr("Día de la Restauración")
# Judgment No. 14 of Feb 20, 2008 of the Supreme Court of Justice
if self._year <= 2007 and self._year % 4 == 0:
self._add_holiday_aug_16(name)
else:
self._move_holiday(self._add_holiday_aug_16(name))
aug_16 = self._add_holiday_aug_16(tr("Día de la Restauración"))
if self._year % 4 != 0:
self._move_holiday(aug_16)

# Our Lady of Mercedes Day.
self._add_holiday_sep_24(tr("Día de las Mercedes"))
Expand Down
Loading

0 comments on commit 6ec8d56

Please sign in to comment.