I currently have been making a leave request form. However, I am having a hard time adding +1 day to the end date of a user’s leave end date. I tried e.date+1
and also e.date+1d
but neither of them works.
Code:
$(function() {
var myDate = new Date();
$('#leaveEndDateFunc').datepicker({
title: 'Leave End Date',
format: 'dd/mm/yyyy',
todayHighlight: true,
autoclose: true,
clearBtn: true,
endDate: "+3M",
}).on("changeDate", function(e) {
$('#dateOfReturn').datepicker('setStartDate', e.date);
});
});
$(function() {
var myDate = new Date();
$('#dateOfReturn').datepicker({
title: 'Date Of Return',
format: 'dd/mm/yyyy',
todayHighlight: false,
autoclose: true,
clearBtn: true,
});
});
2
Answers
You can try this function,
addDays
, to add the days you need.Use
onSelect
. Inside the function usesetDate
on#dateOfReturn
input.Working Example: