jQuery UI datepicker, "disabled days" not working in IE 7 and 8
I use the following function to disable days from 2011-02-13 to 2011-02-18 in the date picker calendar:
function no_disabled_days(date){
dateStr1 = '2011-02-13T00:00:00';
dateStr2= '2011-02-18T00:00:00';
disabled_start_day = new Date(dateS开发者_开发知识库tr1);
disabled_end_day = new Date(dateStr2);
if(date >= disabled_start_day && date <= disabled_end_day){
return [false];
}
return [true];
}
$("#reserve_date").datepicker({
beforeShowDay: no_disabled_Days
});
For example, if dateStr1='2011-02-13T00:00:00', dateStr2='2011-02-18T00:00:00', the days from 2011-02-13 to 2011-02-18 are disabled.
Things are working fine in Chrome and Firfox browswer, however, when I test in IE 7 and 8, things are not working, only datepicker calendar can popup, the disabled_days
is not disabled. Why? How to change my code to let it also working in IE 7 and 8?
By the way, the 'T00:00:00' string is needed to resolve local timezone issue in Firefox,( to make the disable days working in Firefox), check out my other post here
the problem in IE is your format...
try this
alert(new Date('2011-02-13T00:00:00').getDate()); // alerts NaN, your current format
alert(new Date('2011/02/13T00:00:00').getDate()); // alerts 13
alert(new Date('02-13-2011T00:00:00').getDate()); // alerts 13
tested on IE 7
精彩评论