Skip to content
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

Boxing Day is not being shifted when it falls on a Saturday #95

Merged
merged 1 commit into from
Oct 6, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions workalendar/europe.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,14 @@ def get_variable_days(self, year):
days.append(self.get_late_summer_bank_holiday(year))
# Boxing day & XMas shift
christmas = date(year, 12, 25)
boxing_day = date(year, 12, 26)
if christmas.weekday() in self.get_weekend_days():
shift = self.find_following_working_day(christmas)
days.append((shift, "Christmas Shift"))
days.append((shift + timedelta(days=1), "Boxing Day Shift"))
elif boxing_day.weekday() in self.get_weekend_days():
shift = self.find_following_working_day(boxing_day)
days.append((shift, "Boxing Day Shift"))
return days


Expand Down
6 changes: 6 additions & 0 deletions workalendar/tests/test_europe.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,12 @@ def test_shift_2011(self):
self.assertIn(date(2011, 12, 26), holidays) # XMas day shift
self.assertIn(date(2011, 12, 27), holidays) # Boxing day shift

def test_shift_2015(self):
holidays = self.cal.holidays_set(2015)
self.assertIn(date(2015, 12, 25), holidays) # Christmas it's friday
self.assertIn(date(2015, 12, 26), holidays) # Boxing day it's saturday
self.assertIn(date(2015, 12, 28), holidays) # Boxing day shift


class UnitedKingdomNorthernIrelandTest(UnitedKingdomTest):
cal_class = UnitedKingdomNorthernIreland
Expand Down