"use strict";
let nowDate = new Date();
let today = new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate(), 0, 0, 0, 0);
let enddate;
$('#startdatepicker').datepicker({
autoclose:true,
todayHighlight: true,
startDate:today
}).on("changeDate",function(e){
let present=new Date(e.date);
enddate = new Date(present.getFullYear(), present.getMonth(), present.getDate(), 0, 0, 0, 0);
$('#enddatepicker').datepicker({
autoclose: true,
startDate: enddate
});
});
bootstrap-datepicker event onchange not update enddatepicker startDate: value in second time
297 Views Asked by Hein Htet At
1
change onchange to 'change' , and your date not coming from the event variable , you need to get him 'manually' like this :