Exclude Specific Dates from Datepicker

Highlighted
Tourist
4 1 1

Hi,

I have added datepicker to my store (with Sundays excluded) and its been working fine.

Now we're approaching Holiday season and I want to exclude the dates we are closed. I have tried a number of suggestions from the boards but can't get them to work.

Please take a look at my code below and let me know what's going wrong:

<script>
    $(document).ready(function () {
        $('input[id$=DelPickupDate]').datepicker({
            dateFormat: 'DD, d MM, yy',
            defaultDate: "+3d",
          maxDate: "+6m",
          minDate: "+3d",
          beforeShowDay: my_check 
        });
    });
     
           function my_check(in_date) {          
             if (in_date.getDay() == 0) 
             { return [false, "notav", 'Not Available']; } 
 
             else if ( in_date.getDate() == "Friday, 1 January, 2021")         
                { return [false, "notav", 'Closed']; }     
                            
               else 
             { return [true, "av", "Available"]; }                     
             
           }
  
</script>
 
I have tried a number of different formats for the date string I'm testing but nothing seems to work????
 
Many thanks
 
Andrew
0 Likes