Fix magic numbers for months
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Jan Bader 2022-04-23 20:14:20 +00:00
parent 0817f18e33
commit 91ed57f83d

View File

@ -23,16 +23,16 @@ func (m Month) FirstOfMonth() time.Time {
} }
func (m Month) Previous() Month { func (m Month) Previous() Month {
if m.Month == 1 { if m.Month == int(time.January) {
return Month{Year: m.Year - 1, Month: 12} return Month{Year: m.Year - 1, Month: int(time.December)}
} }
return Month{Year: m.Year, Month: m.Month - 1} return Month{Year: m.Year, Month: m.Month - 1}
} }
func (m Month) Next() Month { func (m Month) Next() Month {
if m.Month == 12 { if m.Month == int(time.December) {
return Month{Year: m.Year + 1, Month: 1} return Month{Year: m.Year + 1, Month: int(time.January)}
} }
return Month{Year: m.Year, Month: m.Month + 1} return Month{Year: m.Year, Month: m.Month + 1}