JSFiddle - React, Tailwind, and code Playground
by Brent Scheibelhut
HTML
<script src="https://code.jquery.com/ui/1.11.3/jquery-ui.js"></script>
<label>Date Picker 1</label>
<input type="text" id="datepicker" name="Datepicker" style="border-radius:5px; font-family: sans-serif; color:#333; font-size:14px; margin-bottom:5px;">
<label>Date Picker 2</label>
<input type="text" id="datepicker2" name="Datepicker2" style="border-radius:5px; font-family: sans-serif; color:#333; font-size:14px; margin-bottom:5px;">
<label>Date Picker 3</label>
<input type="text" id="datepicker3" name="Datepicker3" style="border-radius:5px; font-family: sans-serif; color:#333; font-size:14px; margin-bottom:5px;">
<label>Date Picker 4</label>
<input type="text" id="datepicker4" name="Datepicker4" style="border-radius:5px; font-family: sans-serif; color:#333; font-size:14px; margin-bottom:5px;">
JavaScript
var unavailableDates = ["20-5-2015", "21-5-2015", "22-5-2015", "23-5-2015", "24-5-2015", "25-5-2015"];
function unavailable(date) {
dmy = date.getDate() + "-" + (date.getMonth() + 1) + "-" + date.getFullYear();
if ($.inArray(dmy, unavailableDates) < 0) {
return [true, "", "Book Now"];
} else {
return [false, "", "Booked Out"];
}
}
$(function () {
$("#datepicker, #datepicker2, #datepicker3, #datepicker4").datepicker({
minDate: 3,
maxDate: 180,
dateFormat: "DD, d MM, yy",
changeMonth: true,
beforeShowDay: unavailable,
showButtonPanel: true
});
});