I am an apprentice and new to programming, I know very little J-Query, JavaScript etc. I am creating a program where users will book days using a datepicker
. I want all UK Bank Holidays to be disabled in the datepicker. I have a JSON file from the government website which has all the days that I would like to be disabled and other data. I want them to be disabled like the weekend that are currently disabled in the datepicker.
function IsWeekend(date) {
if (date.getDay() === 0 || date.getDay() === 6) return true;
else return false;
}
$(function () {
$(".datepicker").datepicker({
minDate: ('+1d'),
dateFormat: 'dd/mm/yy',
beforeShowDay: function (date) {
return [(!IsWeekend(date))];
}
});
});
The JSON file is in this format
{"england-and-wales":{"division":"england-and-wales","events":[{"title":"New Year\u2019s Day","date":"2012-01-02","notes":"Substitute day","bunting":true},
{"title":"Good Friday","date":"2012-04-06","notes":"","bunting":false}