Skip to content

Commit

Permalink
Fix the month display in case of "line is four"
Browse files Browse the repository at this point in the history
We need to fill in the 5th line.
Fixes #145.
  • Loading branch information
y-yagi committed Apr 21, 2024
1 parent 4fc4c2e commit b0f2e13
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion calendar.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ func (calendar *Calendar) Generate(date time.Time) {
}

wday = int(lastDate.Weekday())
calendar.Body[line] += strings.Repeat(daySpace, 6-wday)
if wday == 6 && line == 4 {
calendar.Body[line] += strings.Repeat(daySpace, 7)
} else {
calendar.Body[line] += strings.Repeat(daySpace, 6-wday)
}
calendar.adjustSpace(line)

for line++; line < len(calendar.Body); line++ {
Expand Down

0 comments on commit b0f2e13

Please sign in to comment.