What I am trying to do with datepicker is when it first shows, display the current date plus 6 months, which you can do with startDate, but the month back button is disabled. I tried to set a minDate for todays date, same deal, month back button is disabled.
Is there away to have the start date to be the current date plus 6 months, but allow users to click the month back button and not allowed to go past the current date.
var date = new Date();
date.setDate(date.getDate() - 1);
var defaultDate = new Date();
defaultDate.setMonth(date.getMonth() + 6);
$('[data-toggle="datepicker"]').datepicker({
format: 'dd/MM/yyyy',
autoHide: true,
minDate: date,
startDate: defaultDate,
changeMonth: true
});
from Datepicker minDate with StartDate
No comments:
Post a Comment