I have following code
$("#in").datepicker({
minDate: 0,
onSelect: function (dateText, inst) {
dateText = new Date(dateText);
dateText = dateText.getDate()+1;
$('#out').datepicker("option", 'minDate', dateText);
}
});
Example: https://jsfiddle.net/ANYTA/1/
However, the out datepicker is adding 10 days instead of 1 day. What could be modified to make it work as intended? thank you very much
dateText = dateText.setDate(dateText.getDate()+1);
NOTE
somedate.setDate(days);
days is integer
Expected values are 1-31, but other values are allowed:
2.1) 0 will result in the last hour of the previous month
2.1) -1 will result in the hour before the last hour of the previous month
when month has 31 days, then 32 will result in the first day of the next month
If month has 30 days then, 32 will result in the second day of the next month
Your code shoule
$("#in").datepicker({
minDate: 0,
onSelect: function(dateText, inst) {
var actualDate = new Date(dateText);
var newDate = new Date(actualDate.getFullYear(), actualDate.getMonth(), actualDate.getDate()+1);
$('#out').datepicker('option', 'minDate', newDate );
}
});
$("#out").datepicker();
DEMO
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