My problem is basic. I have a reservation system where enter the date of entry and exit. I have validated that the departure date can not be less than the entry date and the entry date can not be greater than the departure date and when they modify the entry date, the exit date is reset to avoid inconvenience. The scare is that I need my minimum departure date one day more than the entry date. That is, if I select the date of entry for 20 the minimum date for output should be 21. Try using startdate +1 but it does not work since my departure date is defined according to the input. I am currently working that the departure date starts at the same as the entry, I need it to be a day after the entry.
I think my problem is in this part "getDate (selected)". I hope you can help me.
<script type="text/javascript">
$(function () {
var getDate = function (input) {
return new Date(input.date.valueOf());
}
$('#entrada').datepicker({
format: "dd/mm/yyyy",
language: 'es',
startDate: '+5d',
endDate: '+35d',
autoclose: true,
});
var a = $('#entrada').datepicker("getDate");
$('#salida').datepicker({
startDate: '+6d',
format: "dd/mm/yyyy",
language: "es",
endDate: '+36d',
autoclose: true
});
$('#entrada').datepicker({
}).on('changeDate',
function (selected) {
$('#salida').datepicker('clearDates');
$('#salida').datepicker('setStartDate', getDate(selected));
});
});
</script>
<input type="text" name="entrada" id="entrada" value="">
<input type="text" name="salida" id="salida" value="" >