I need to add maxdate for datepicker and i am using this plugin
cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/js/bootstrap-datepicker.min.js
and this is my datepicker code:
.datepicker({
autoclose: true,
todayHighlight: true,
format: 'mm/dd/yyyy',
minDate: new Date(),
maxDate: +42,
startDate: indianTimeZoneVal
})
But maxdate is not working i need current date to next 42 days
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))
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With