-
-
Notifications
You must be signed in to change notification settings - Fork 539
Add Anguilla holidays #2410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have done some research and compiled a list of references that I believe will be helpful for this issue. Could you please verify these references for me? Once confirmed, I can proceed with the next steps. Thank you!
|
1-3 (in fact, it is one address, in terms of citation) - source for 2011-2022 dates, looks very good |
Is this a good way to implement? # Anguilla Day is on May 30th
anguilla_day = self._add_holiday_may_30(tr("Anguilla Day"))
# Whit Monday is already defined
whit_monday = self._add_whit_monday(tr("Whit Monday"))
# If Anguilla Day (May 30th) coincides with Whit Monday, move Anguilla Day to May 31st
if self._is_same_day(anguilla_day, whit_monday):
anguilla_day = self._add_holiday_may_31(tr("Anguilla Day"))
# If Anguilla Day falls on a Saturday or Sunday, move to the next Monday
# If that Monday is Whit Monday, move Anguilla Day to the following Tuesday
if self._is_weekend(anguilla_day):
next_monday = self._add_observed(anguilla_day, rule=SAT_SUN_TO_NEXT_MON)
if self._is_same_day(next_monday, whit_monday):
anguilla_day = self._add_observed(next_monday, rule=TO_NEXT_TUE)
else:
anguilla_day = next_monday Reference : REVISED REGULATIONS OF ANGUILLA |
Discussing code chunks in issue comments is a bit strange, but...
What is
After that, holiday already exists, and if it coincides with Whit Monday, it must be moved using |
Thank you for pointing that out! I got stuck and sought assistance, but I thought it would be best to first ask here if it’s okay to proceed with that approach. I apologize for using the Issues section for this and will ensure to handle it more appropriately going forward. |
This works for me, but probably could be simplified: from holidays.calendars.gregorian import MAY, JUN # Whit Monday.
whit_monday = self._add_whit_monday(tr("Whit Monday"))
dt = date(self._year, MAY, 30)
if whit_monday == dt:
dt = (MAY, 31)
elif self._is_saturday(dt):
dt = (JUN, 2 if whit_monday == date(self._year, JUN, 1) else 1)
elif self._is_sunday(dt):
dt = (JUN, 1) if whit_monday == date(self._year, MAY, 31) else (MAY, 31)
# Anguilla Day.
anguilla_day = self._add_holiday(tr("Anguilla Day"), dt) Edit: Version 2 from datetime import date
from holidays.calendars.gregorian import MAY, _timedelta # Whit Monday.
whit_monday = self._add_whit_monday(tr("Whit Monday"))
dt = date(self._year, MAY, 30)
# Step 1: Move if Weekend.
if self._is_weekend(dt):
dt = _timedelta(dt, +2) if self._is_saturday(dt) else _timedelta(dt, +1)
# Step 2: Move (again) if Whit Monday.
if whit_monday == dt:
dt = _timedelta(dt, +1)
# Anguilla Day.
anguilla_day = self._add_holiday(tr("Anguilla Day"), dt) |
URLs:
The text was updated successfully, but these errors were encountered: