How can I set the minDate/maxDate for jQueryUI Datepicker using a string?

纵然是瞬间 提交于 2019-12-01 09:10:37

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!