From 949a30e00105ee22f3267ff468710ac034c5d7c5 Mon Sep 17 00:00:00 2001 From: Cyrille Nofficial Date: Mon, 18 Apr 2022 12:37:10 +0200 Subject: [PATCH] fix(calendar): bad compute for paques monday --- calendar/calendar.go | 2 +- calendar/calendar_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/calendar/calendar.go b/calendar/calendar.go index b27d34c..5ffab2d 100644 --- a/calendar/calendar.go +++ b/calendar/calendar.go @@ -50,7 +50,7 @@ func (cal *Calendar) GetHolidays(year int) *[]time.Time { // Jour de l'an time.Date(year, time.January, 1, 0, 0, 0, 0, cal.Location), // Easter - paques, + paques.AddDate(0, 0, 1), // 1 mai time.Date(year, time.May, 1, 0, 0, 0, 0, cal.Location), // 8 mai diff --git a/calendar/calendar_test.go b/calendar/calendar_test.go index 7a5cf6d..2756610 100644 --- a/calendar/calendar_test.go +++ b/calendar/calendar_test.go @@ -18,7 +18,7 @@ func TestCalendar_GetEasterDay(t *testing.T) { time.Date(2021, time.April, 4, 0, 0, 0, 0, loc), } - c := Calendar{loc} + c := New(loc) for _, d := range easterDays { easter := c.GetEasterDay(d.Year()) @@ -37,7 +37,7 @@ func TestCalendar_GetHolidays(t *testing.T) { expectedHolidays := map[time.Time]bool{ time.Date(2020, time.January, 1, 0, 0, 0, 0, loc): true, - time.Date(2020, time.April, 12, 0, 0, 0, 0, loc): true, + time.Date(2020, time.April, 13, 0, 0, 0, 0, loc): true, time.Date(2020, time.May, 1, 0, 0, 0, 0, loc): true, time.Date(2020, time.May, 8, 0, 0, 0, 0, loc): true, time.Date(2020, time.May, 21, 0, 0, 0, 0, loc): true,