jQueryUI Datepicker documentation states that the minDate option can be set using \"a string in the current dateFormat\". So I\'ve tried the following to initialize datepick
I found your last method to be best for IE7/8 anyway. IE returns NaN in string-fed Date functions; as soon as I parsed to numbers the problem disappeared.
In the end I had to use something like this, since the v1.7 datepicker has no probs with Dates:
$.getJSON("/GetMinMaxDates/", function(dates) {
var DateLimits = {min:null, max:null};
DateLimits.min = new Date(Date.parse(dates.min));
DateLimits.max = new Date(Date.parse(dates.max));
$("input.date").datepicker({ dateFormat: "mm/dd/yy", minDate: DateLimits.min, maxDate: DateLimits.max });
});
Appears to be a "bug" in 1.3.2 with 1.7.2. In 1.4.2 with 1.8.1 all is fine.