Edit: working fiddle: http://jsfiddle.net/yao6dgex/
Edit 2: I think I know what's going on, but no reason why, it' getting the actual day and adding the days, instead of adding days from the selected date.
I have found this answer to my question, but it's not solving anything at all.
The problem is, that when I add X days, in the same calendar or another one, it's going to the next month in the X day.
My code looks like:
$(document).ready(function() {
$("#cal3").datepicker({
showOtherMonths: true,
selectOtherMonths: true,
dateFormat: "dd/mm/y",
onSelect: function(selectedDate) {
$("#cal4").datepicker("setDate", selectedDate);
$("#cal4").datepicker("setDate", "+3d");
$("#cal4").datepicker( "option", "minDate", selectedDate );
}
});
$("#cal4").datepicker({
showOtherMonths: true,
selectOtherMonths: true,
dateFormat: "dd/mm/y",
onSelect: function(selectedDate) {
$("#cal3").datepicker( "option", "maxDate", selectedDate );
}
});
});
In this example, I added the selected date to cal4 and then add 3 days from it.
Datepicker setDate API says:
Sets the date for the datepicker. The new date may be a Date object or a string in the current date format (e.g., "01/26/2009"), a number of days from today (e.g., +7) or a string of values and periods ("y" for years, "m" for months, "w" for weeks, "d" for days, e.g., "+1m +7d"), or null to clear the selected date.
I'm trying to add X days with "+Xd", so, why it is not working?