Remove outer if, and use a ternary on this line `i === 0 ? prevMonth : nextMonth` as otherwise the handler object is the same