From 05e4db1623918a8e7978d93c58cb097031d57586 Mon Sep 17 00:00:00 2001 From: Nick Van Doorn Date: Thu, 11 May 2017 22:50:40 -0700 Subject: Fix extra full week for next month bug I think there may be a cleaner equation for this.... --- src/client/components/datepicker/calendar/calendar.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client/components/datepicker/calendar/calendar.js b/src/client/components/datepicker/calendar/calendar.js index 1b77969..602fc6c 100644 --- a/src/client/components/datepicker/calendar/calendar.js +++ b/src/client/components/datepicker/calendar/calendar.js @@ -24,7 +24,8 @@ function makeDayGrid (m, onClick) { const prevMonthDays = range(firstDayOfMonth).reverse() .map(k => ) const thisMonthDays = range(daysInMonth).map(k => ) - const nextMonthDays = range(7 - ((prevMonthDays.length + thisMonthDays.length) % 7)) + const nDaysNextMonth = 7 - ((prevMonthDays.length + thisMonthDays.length) % 7) + const nextMonthDays = range(nDaysNextMonth < 7 ? nDaysNextMonth : 0) .map(k => ) // Join and return in tbody -- cgit v1.2.3