Skip to content

Commit

Permalink
Update Johor (Malaysia) and United Arab Emirates weekend observance…
Browse files Browse the repository at this point in the history
…, cleanup others (#2048)

Co-authored-by: ~Jhellico <[email protected]>
  • Loading branch information
PPsyrius and KJhellico authored Oct 12, 2024
1 parent 3d2f6b0 commit ebe2ca0
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 89 deletions.
1 change: 0 additions & 1 deletion holidays/countries/egypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self, JULIAN_CALENDAR)
InternationalHolidays.__init__(self)
IslamicHolidays.__init__(self)

super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
Expand Down
2 changes: 1 addition & 1 deletion holidays/countries/jordan.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self, *args, **kwargs):
def _populate_public_holidays(self):
# The resting days are Friday and Saturday since Jan 6, 2000.
# https://archive.wfn.org/2000/01/msg00078.html
self.weekend = {FRI, SAT} if self._year >= 2000 else {THU, FRI}
self.weekend = {THU, FRI} if self._year <= 1999 else {FRI, SAT}

# New Year's Day.
self._add_new_years_day(tr("رأس السنة الميلادية"))
Expand Down
2 changes: 1 addition & 1 deletion holidays/countries/kuwait.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self, *args, **kwargs):
def _populate_public_holidays(self):
# The resting days are Friday and Saturday since Sep 1, 2007.
# https://www.arabnews.com/node/298933
self.weekend = {FRI, SAT} if self._year >= 2007 else {THU, FRI}
self.weekend = {THU, FRI} if self._year <= 2006 else {FRI, SAT}

# New Year's Day.
self._add_new_years_day(tr("رأس السنة الميلادية"))
Expand Down
8 changes: 7 additions & 1 deletion holidays/countries/malaysia.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
DEC,
FRI,
SAT,
SUN,
)
from holidays.groups import (
BuddhistCalendarHolidays,
Expand Down Expand Up @@ -220,12 +221,17 @@ def _populate_subdiv_holidays(self):

super()._populate_subdiv_holidays()

if self.subdiv in {"01", "02"}:
if (
self.subdiv == "01" and (self._year <= 1994 or 2014 <= self._year <= 2024)
) or self.subdiv == "02":
self._observed_rule = FRI_TO_NEXT_WORKDAY
self.weekend = {FRI, SAT}
elif self.subdiv in {"03", "11"}:
self._observed_rule = SAT_TO_NEXT_WORKDAY
self.weekend = {FRI, SAT}
else:
self._observed_rule = SUN_TO_NEXT_WORKDAY
self.weekend = {SAT, SUN}

if self.observed:
self._populate_observed(self.dts_observed)
Expand Down
1 change: 0 additions & 1 deletion holidays/countries/mauritania.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class Mauritania(HolidayBase, InternationalHolidays, IslamicHolidays):
def __init__(self, *args, **kwargs):
InternationalHolidays.__init__(self)
IslamicHolidays.__init__(self)

super().__init__(*args, **kwargs)

def _populate(self, year):
Expand Down
7 changes: 5 additions & 2 deletions holidays/countries/united_arab_emirates.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from gettext import gettext as tr

from holidays.calendars import _CustomIslamicHolidays
from holidays.calendars.gregorian import APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, FRI, SAT
from holidays.calendars.gregorian import APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, FRI, SAT, SUN
from holidays.groups import InternationalHolidays, IslamicHolidays
from holidays.holiday_base import HolidayBase

Expand All @@ -35,14 +35,17 @@ class UnitedArabEmirates(HolidayBase, InternationalHolidays, IslamicHolidays):
# %s (estimated).
estimated_label = tr("(تقدير) %s")
supported_languages = ("ar", "en_US")
weekend = {FRI, SAT}

def __init__(self, *args, **kwargs):
InternationalHolidays.__init__(self)
IslamicHolidays.__init__(self, cls=UnitedArabEmiratesIslamicHolidays)
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
# The resting days are Saturday and Sunday since Jan 1, 2022.
# https://time.com/6126260/uae-working-days-weekend/
self.weekend = {FRI, SAT} if self._year <= 2021 else {SAT, SUN}

# New Year's Day.
self._add_new_years_day(tr("رأس السنة الميلادية"))

Expand Down
Loading

0 comments on commit ebe2ca0

Please sign in to comment.