Fix grid-offset when month starts on Sunday like February 2015

This commit is contained in:
Eric Eastwood 2022-02-17 21:28:38 -06:00
parent b41ee62e59
commit 4f506f0b7e
1 changed files with 3 additions and 2 deletions

View File

@ -152,9 +152,10 @@ class CalendarView extends TemplateView {
// day number from 0 (monday) to 6 (sunday)
const dayNumber = dayNumberDate.getUTCDay();
// +1 because we actually start the week on the calendar on Sunday(6) instead of Monday(0)
// %7 to rollover the 7-day week
// +1 because we're going from 0-based day to 1-based `grid-column-start`
// +1 because we actually start the week on Sunday(6) instead of Monday(0)
const gridColumnStart = dayNumber + 1 + 1;
const gridColumnStart = ((dayNumber + 1) % 7) + 1;
dayNodes.push(
t.li(