jQuery - Datepicker Block out date range

HayleyVOC
New Member
2 0 0

Hey,

I used the tutorial on adding the datepicker to the checkout and have added rules. I am not trying to block out a specific date range and have been unsuccessful in doing so. Any assistance would be very much appreciated! 

 

The date range is 24-12-2021 through to 01/04/2022

 

This is what I currently have 

 

<script>

   $(document).ready( function() {

$(function() {

$("#date").datepicker( {

firstDay: 1,

minDate: +0,

maxDate: '+2M',

dateFormat: 'DD d MM yy' ,

beforeShowDay: $.datepicker.noWeekends,

beforeShow : function(){

var dateTime = new Date();

var hour = dateTime.getHours();

if(hour>=10){

$(this).datepicker( "option", "minDate", "+1" );

}

} } );

});

  $('input[name="checkout"], input[name="goto_pp"], input[name="goto_gc"]').click(function() {

if ($('#date').val() == "" || $('#date').val() === undefined)

  {

alert("You must pick a delivery date");

return false;

} else {

//$(this).submit();

return true;

}

});

});

  </script>

 

 

Replies 0 (0)