Datepicker opens when "setDate" option is supplied.
<div dir="ltr">Below is the config of my datepickers.
$("#leaving,#returning").datepicker({
numberOfMonths: [1,1],
showOn: "focus",
defaultDate: "today",
changeFirstDay: false,
minDate: "today",
maxDate: "+330d",
hideIfNoPrevNext: true,
onSelect: function(dateText, input) {
if(<a href="http://input.id">input.id</a> == "leaving"){
var leaving = $("#leaving").datepicker("getDate");
var returning = $("#returning").datepicker("getDate");
if(returning != null && leaving>returning) {
$("#returning").datepicker("setDate", leaving);
}
}
},
beforeShow: customRange
}).attr("readonly", "readonly");
The only way to default the date is to call
$("#leaving").datepicker("setDate", "today");
$("#returning").datepicker("setDate", "+3d");
This causes the second datepicker to display as the page is loaded. Is this the default behavior? I tried to add the following and it does not help.
$("#returning").datepicker("hide");
$("#leaving").datepicker("hide");
</div>