JSFiddle - React, Tailwind, and code Playground
by lemon kazi
HTML
<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.21/themes/base/jquery-ui.css">
<input id="thedate" type="text" />
JavaScript
$(function(){
var availableDates = ["15-1-2020","16-1-2020"];
$('#thedate').datepicker({
beforeShowDay: function(d) {
return [!(d.getDay()==0||d.getDay()==6) || available(d), "" ]
},
changeMonth: true, changeYear: false
});
});
function available(date) {
var noWeekend = $.datepicker.noWeekends(date);
if (noWeekend[0]) {
dmy = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear();
if ($.inArray(dmy, availableDates) != -1) {
return true;
} else {
return true;
}
} else {
return false;
}
}