From 4f506f0b7e05e4342174dd02e7769194ee414113 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Thu, 17 Feb 2022 21:28:38 -0600 Subject: [PATCH] Fix grid-offset when month starts on Sunday like February 2015 --- shared/CalendarView.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shared/CalendarView.js b/shared/CalendarView.js index 04a51e9..b1ebf44 100644 --- a/shared/CalendarView.js +++ b/shared/CalendarView.js @@ -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(