Skip to content

Commit

Permalink
gb: add platinum jubilee changes for 2022
Browse files Browse the repository at this point in the history
Fixes #89
  • Loading branch information
rickar committed Feb 8, 2022
1 parent aa53bd0 commit 3fb8ee0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
25 changes: 25 additions & 0 deletions v2/gb/gb_holidays.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,29 @@ var (
Weekday: time.Monday,
Offset: -1,
Func: cal.CalcWeekdayOffset,
Except: []int{2022},
}

// SpringHoliday2022 represents Spring Bank Holiday in 2022 only on 2-Jun
SpringHoliday2022 = &cal.Holiday{
Name: "Spring Bank Holiday",
Type: cal.ObservanceBank,
Month: time.June,
Day: 2,
Func: cal.CalcDayOfMonth,
StartYear: 2022,
EndYear: 2022,
}

// PlatinumJubilee represents Platinum Jubilee Bank Holiday in 2022 only on 3-Jun
PlatinumJubilee = &cal.Holiday{
Name: "Platinum Jubilee Bank Holiday",
Type: cal.ObservanceBank,
Month: time.June,
Day: 3,
Func: cal.CalcDayOfMonth,
StartYear: 2022,
EndYear: 2022,
}

// SummerHolidayScotland represents Summer Bank Holiday in Scotland on the first Monday of August
Expand Down Expand Up @@ -98,6 +121,8 @@ var (
EarlyMay,
VEDay,
SpringHoliday,
SpringHoliday2022,
PlatinumJubilee,
SummerHoliday,
ChristmasDay,
BoxingDay,
Expand Down
11 changes: 10 additions & 1 deletion v2/gb/gb_holidays_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,16 @@ func TestHolidays(t *testing.T) {
{SpringHoliday, 2019, d(2019, 5, 27), d(2019, 5, 27)},
{SpringHoliday, 2020, d(2020, 5, 25), d(2020, 5, 25)},
{SpringHoliday, 2021, d(2021, 5, 31), d(2021, 5, 31)},
{SpringHoliday, 2022, d(2022, 5, 30), d(2022, 5, 30)},
{SpringHoliday, 2022, time.Time{}, time.Time{}},
{SpringHoliday, 2023, d(2023, 5, 29), d(2023, 5, 29)},

{SpringHoliday2022, 2021, time.Time{}, time.Time{}},
{SpringHoliday2022, 2022, d(2022, 6, 2), d(2022, 6, 2)},
{SpringHoliday2022, 2023, time.Time{}, time.Time{}},

{PlatinumJubilee, 2021, time.Time{}, time.Time{}},
{PlatinumJubilee, 2022, d(2022, 6, 3), d(2022, 6, 3)},
{PlatinumJubilee, 2023, time.Time{}, time.Time{}},

{SummerHolidayScotland, 2015, d(2015, 8, 3), d(2015, 8, 3)},
{SummerHolidayScotland, 2016, d(2016, 8, 1), d(2016, 8, 1)},
Expand Down

0 comments on commit 3fb8ee0

Please sign in to comment.