diff --git a/main.go b/main.go index 8ec34bc..e4760c3 100644 --- a/main.go +++ b/main.go @@ -388,8 +388,13 @@ func prepareDays(t time.Time) []Day { var days []Day - curDate := t.AddDate(0, 0, -t.Day()+1) - preDays := int(curDate.Weekday()) - 1 + curDate := t.AddDate(0, 0, -(t.Day()-1)) + preDays := int(curDate.Weekday()) + if preDays == 0 { + preDays = 7 + } + preDays -= 1 + maxDays := daysInMonth(curDate.Year(), curDate.Month()) endOfMonth := false