I need help in disabling specific dates on the jquery datepicker. I have successfully blocked out Sundays but I don't know how I could add blocked dates to the calendar. I looked through the existing questions and answers but the solutions inside didn't work. Here is the script I have to written. I will really appreciate help. I am not a programmer.
{{ '//code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css' | stylesheet_tag }}
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js" defer="defer"></script>
<div style="width:100%; clear:both; margin: 10px 0;">
<p>
<label for="date">CHOOSE A DELIVERY/PICKUP DATE:</label>
<input readonly="readonly" id="date" type="text" name="attributes[date]" value="{{ cart.attributes.date }}" />
</p>
</div>
<script>
window.onload = function() {
if (window.jQuery) {
let $ = window.jQuery;
$(function() {
$("#date").datepicker({
minDate: +2,
maxDate: '+6M',
beforeShowDay: noSundays,
dateFormat: "dd/mm/yy"
});
});
function noSundays(date){
if (date.getDay() === 0) /* Sunday */
return [ false, "", "" ]
else
return [ true, "", "" ]
}
}
}
</script>