I have implemented a bootstrap datepicker for policy start, so that I want to show user to select dates from current month and next month only.
Can anyone tell me how is it possible in bootstrap datepicker?
$(".policy-start-dp").datepicker({
});
I have implemented a bootstrap datepicker for policy start, so that I want to show user to select dates from current month and next month only.
Can anyone tell me how is it possible in bootstrap datepicker?
$(".policy-start-dp").datepicker({
});
You need to set the minimum and maximum values of the date picker
//Get Current Date
var date = new Date();
//Create Variable for first day of current month
var firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
//Create variable for last day of next month
var lastDay = new Date(date.getFullYear(), date.getMonth() + 2, 0);
$( "#datepicker" ).datepicker({
minDate: firstDay,
maxDate: lastDay
});
Hope that helps :)
no need to set start and end date just pust the "startDate" code is below.
var changeDateFormat = () => {
if ($(fileMonths).parent().parent().hasClass('sandbox-container')) {
$('#fileMonths').datepicker({
autoclose: true,
minViewMode: 1,
startDate: '0m',
format: "mm/yyyy"
});
}
};
date picker months