Is it possible to populate this jQuery UI datepicker calendar with data from a JSON file containing all non-working days for the years 2017 and 2018?
P.S.
return [!(month == 8 && day == 27), 'highlight', highlight];
- This example demonstrates how dates can be highlighted in red color. I want to achieve the same functionality using a JSON file with multiple dates.
$(function() {
$('#calendar').datepicker({
dateFormat: 'yyyy/mm/dd',
inline: true,
firstDay: 1,
showOtherMonths: false,
beforeShowDay: function nonWorkingDates(date) {
var highlight = nonWorkingDates[date];
var month = date.getMonth() + 1;
var day = date.getDate();
var year = date.getFullYear();
return [!(month == 8 && day == 27), 'highlight', highlight];
}
});
});
body {
font: bold 14px Arial;
}
#wrapper {
padding: 50px 0 0 325px;
}
#calendar {
margin: 25px auto;
width: 370px;
height:
}
/* CSS styles removed for brevity */
<!DOCTYPE html>
...