fix(calendar): bad compute for paques monday

This commit is contained in:
Cyrille Nofficial 2022-04-18 12:37:10 +02:00
parent 7db9a124d8
commit 949a30e001
2 changed files with 3 additions and 3 deletions

View File

@ -50,7 +50,7 @@ func (cal *Calendar) GetHolidays(year int) *[]time.Time {
// Jour de l'an // Jour de l'an
time.Date(year, time.January, 1, 0, 0, 0, 0, cal.Location), time.Date(year, time.January, 1, 0, 0, 0, 0, cal.Location),
// Easter // Easter
paques, paques.AddDate(0, 0, 1),
// 1 mai // 1 mai
time.Date(year, time.May, 1, 0, 0, 0, 0, cal.Location), time.Date(year, time.May, 1, 0, 0, 0, 0, cal.Location),
// 8 mai // 8 mai

View File

@ -18,7 +18,7 @@ func TestCalendar_GetEasterDay(t *testing.T) {
time.Date(2021, time.April, 4, 0, 0, 0, 0, loc), time.Date(2021, time.April, 4, 0, 0, 0, 0, loc),
} }
c := Calendar{loc} c := New(loc)
for _, d := range easterDays { for _, d := range easterDays {
easter := c.GetEasterDay(d.Year()) easter := c.GetEasterDay(d.Year())
@ -37,7 +37,7 @@ func TestCalendar_GetHolidays(t *testing.T) {
expectedHolidays := map[time.Time]bool{ expectedHolidays := map[time.Time]bool{
time.Date(2020, time.January, 1, 0, 0, 0, 0, loc): true, 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, 1, 0, 0, 0, 0, loc): true,
time.Date(2020, time.May, 8, 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, time.Date(2020, time.May, 21, 0, 0, 0, 0, loc): true,