Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions financepy/utils/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -1857,6 +1857,10 @@ def holiday_new_zealand(self, dt: Date, day_in_year: int, weekday: int):
if m == 1 and d == 3 and weekday == Date.MON:
return True

# Jan 1 Sunday -> Jan 3 Tuesday (Jan 2 is the Monday holiday)
if m == 1 and d == 3 and weekday == Date.TUE:
return True

if m == 1 and d == 4 and weekday in (Date.MON, Date.TUE):
return True

Expand Down
1 change: 1 addition & 0 deletions tests/regression/golden/TestFinCalendar_GOLDEN.testLog
Original file line number Diff line number Diff line change
Expand Up @@ -1933,6 +1933,7 @@ RESULTS,NEW_ZEALAND,TUE DEC 27 2022,
BANNER,================================
RESULTS,NEW_ZEALAND,SUN JAN 01 2023,
RESULTS,NEW_ZEALAND,MON JAN 02 2023,
RESULTS,NEW_ZEALAND,TUE JAN 03 2023,
RESULTS,NEW_ZEALAND,MON FEB 06 2023,
RESULTS,NEW_ZEALAND,FRI APR 07 2023,
RESULTS,NEW_ZEALAND,MON APR 10 2023,
Expand Down
11 changes: 11 additions & 0 deletions tests/unit/test_FinCalendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,17 @@ def test_uk_moved_bank_holidays(cal_type):
assert cal.is_holiday(dt), dt


def test_nz_new_year_on_sunday_observed_on_tuesday():
cal = Calendar(CalendarTypes.NEW_ZEALAND)

# 1 January falls on a Sunday, so 2 January (Monday) is the day after
# New Year's Day and New Year's Day itself is observed on 3 January
for y in [2006, 2012, 2017, 2023]:
assert cal.is_holiday(Date(2, 1, y)), y
assert cal.is_holiday(Date(3, 1, y)), y
assert cal.is_business_day(Date(4, 1, y)), y


def test_modified_following_does_not_cross_month():
cal = Calendar(CalendarTypes.WEEKEND)

Expand Down
Loading