jQuery datepicker disable Mondays except 2 specific Monday every year

12 Views Asked by At

I have a jQuery datepicker that has Mondays Disabled but I am trying to figure out how can I unable a couple of Monday in December

var unableDates = ["4-12-2023", "11-12-2023", "18-12-2023"];
jQuery(function($){
    $("#group").attr('readonly', 'readonly');
    $("#group").datepicker({
    minDate: new Date(2023, 10, 1),    
    dateFormat: 'dd.mm.yy',
    beforeShowDay: function(date){
    if ( date.getDay() === 'unableDates' ||date.getDay() === 2 ||date.getDay() === 3 ||date.getDay() === 4 ||date.getDay() === 5){
            return [true];
        }
        return [false]
    }
});

all works fine until I add the variable 'unableDates'

all works fine until I add the variable 'unableDates'

0

There are 0 best solutions below