开发者

Disable list of holidays in Jquery date picker

开发者 https://www.devze.com 2023-01-01 01:39 出处:网络
开发者_开发知识库How to disable a list of holidays using jquery date picker?var disabledDates = [\'08/30/2010\', \'05/30/2010\', \'02/14/2011\'];
开发者_开发知识库

How to disable a list of holidays using jquery date picker?


var disabledDates = ['08/30/2010', '05/30/2010', '02/14/2011']; 

function noWeekendsOrHolidays(date) { 
        var noWeekend = $.datepicker.noWeekends(date); 
        if (noWeekend[0]) { 
            return disableDays(date); 
        } else { 
            return noWeekend; 
        } 
} 

function disableDays(date) { 
    for (var i = 0; i < disabledDates.length; i++) { 
        if (new Date(disabledDates[i]).toString() == date.toString()) {              
            return [false]; 
        } 
    } 
    return [true]; 
}  

$(.selector).datepicker({minDate: new Date(),beforeShowDay: noWeekendsOrHolidays, changeYear: true ,changeMonth: true});   
0

精彩评论

暂无评论...
验证码 换一张
取 消