I have two buttons for getting next and previous months with fulldays. I have included moment js. At-present when I click on next button I am getting December and end date is 28th, then I click again getting the same month not January. When I click on previous button October is getting, then I click again getting the same month not September.
$('.datepicker__month-button--next').on('click', function () {
console.log('next');
console.log(moment().add(1, 'months'));
});
$('.datepicker__month-button--prev').on('click', function () {
console.log('prev');
console.log(moment().subtract(1, 'months'));
});
You can do it like below:
Online demo (fiddle)