Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions financepy/utils/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -3078,13 +3078,8 @@ def holiday_target(self, dt: Date, day_in_year):
if m == 5 and d == 1: # May day
return True

em = self.easter_monday(y)

if dt == em.add_days(-3): # Good Friday
return True

if dt == em: # Easter Monday
return True
if not MIN_CALENDAR_YEAR <= y <= MAX_CALENDAR_YEAR:
self.easter_monday(y) # raises the year-range error

if m == 12 and d == 25: # Xmas bank holiday
return True
Expand All @@ -3096,6 +3091,11 @@ def holiday_target(self, dt: Date, day_in_year):
if m == 12 and d == 31 and y in (1999, 2001):
return True

if m == 3 or m == 4:
# Easter Monday falls between Mar 24 and Apr 26 and Good Friday
# is three days before it
return day_in_year - easter_monday_day[y - MIN_CALENDAR_YEAR] in (0, -3)

return False

###########################################################################
Expand Down
Loading