Jquery Bootstrap Datepicker disable past dates except n number of dates

Suppose if we want to disable all the past dates except last 7days from the current date.

you can do it like this

jQuery(document).ready(function () {
var nowDate = new Date();
var today = new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate(), 0, 0, 0, 0);
jQuery(‘#payout_date_picker’).datepicker({
startDate: ‘-7d’,
format: ‘dd-mm-yyyy’,
autoclose:true
});

});

Note: replace 7 with whatever days you want.

One comment

Add Comment

Required fields are marked *. Your email address will not be published.