How to add maxdate in bootstrap datepicker

Not sure bootstrap-datepicker has minDate and maxDate.

But for sure it has startDate and endDate instead. Try this,

.datepicker({
 autoclose: true,
 todayHighlight: true,
 format: 'mm/dd/yyyy',
 startDate: new Date(),
 endDate: new Date(new Date().setDate(new Date().getDate() + 5))
})

Here is the example fiddler for your reference.

Hope it helps.


$('#element').datepicker({
autoclose: true,
todayHighlight: true,
format: 'mm/dd/yyyy',
startDate:  new Date(),                                            
endDate: new Date(new Date().setDate(new Date().getDate() + 42)),
minDate:  new Date(),                                            
maxDate: new Date(new Date().setDate(new Date().getDate() + 42))
})