I'm using bootstrap datetimepicker, how do I add one day in datetimepicker bootstrap minDate
?
I want to filter the minDate
for more 1 day. For example my checkIn
datetimepicker is 02/16/18 then the the date to 02/16/18 is disabled in checkOut
datetimepicker.
<script>
$(function () {
$('#CheckIn').datetimepicker({
format: 'MM/DD/YYYY'
});
$('#CheckOut').datetimepicker({
useCurrent: false,//Important! See issue #1075
format: 'MM/DD/YYYY'
});
$("#CheckIn").on("dp.change", function (e) {
$('#CheckOut').data("DateTimePicker").minDate(e.date);
});
$("#CheckOut").on("dp.change", function (e) {
$('#CheckIn').data("DateTimePicker").maxDate(e.date);
});
});
</script>
As the docs says,
dp.change
:since
e.date
is a moment object you can useadd
method.Here a live example:
Thanks for the great help. It works for me too. But I need to add 3 days. if anyone need my code then use it.