Start week on Monday

This commit is contained in:
2025-12-10 11:17:13 +01:00
parent 4cb97a25ba
commit 248085a4da
2 changed files with 8 additions and 2 deletions

View File

@@ -214,9 +214,15 @@ func (h *Handlers) buildCalendarData(year int, month time.Month) map[string]any
days[day] = content
}
// Calculate first day offset (0 = Sunday)
// Calculate first day offset (0 = Monday, 6 = Sunday)
firstDay := time.Date(year, month, 1, 0, 0, 0, 0, time.Local)
firstDayWeekday := int(firstDay.Weekday())
// Adjust so Monday = 0, Sunday = 6
if firstDayWeekday == 0 {
firstDayWeekday = 6
} else {
firstDayWeekday--
}
// Previous/next month
prevMonth := time.Date(year, month-1, 1, 0, 0, 0, 0, time.Local)

View File

@@ -21,13 +21,13 @@
</div>
<div class="calendar-weekdays">
<span>Sun</span>
<span>Mon</span>
<span>Tue</span>
<span>Wed</span>
<span>Thu</span>
<span>Fri</span>
<span>Sat</span>
<span>Sun</span>
</div>
<div class="calendar-grid">