diff options
author | Nick Van Doorn <vandoorn.nick@gmail.com> | 2017-05-11 22:50:40 -0700 |
---|---|---|
committer | Nick Van Doorn <vandoorn.nick@gmail.com> | 2017-05-11 22:52:44 -0700 |
commit | 05e4db1623918a8e7978d93c58cb097031d57586 (patch) | |
tree | b39da22ee4be90c5eec5a668773ed3a31ac0d27e | |
parent | 416b630c0062c3d77715f690f2ab1512071a8343 (diff) |
Fix extra full week for next month bug
I think there may be a cleaner equation for this....
-rw-r--r-- | src/client/components/datepicker/calendar/calendar.js | 3 |
1 files changed, 2 insertions, 1 deletions
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 => <Day classNames={[prevMonth]} key={`prev-${k}`} i={nDaysPrevMonth - k} />) const thisMonthDays = range(daysInMonth).map(k => <Day onClick={onClick} i={k + 1} key={k} classNames={k + 1 === selectedDay ? [active] : []} />) - 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 => <Day classNames={[nextMonth]} key={`next-${k}`} i={k + 1} />) // Join and return in tbody |