JSFiddle - React, Tailwind, and code Playground

by akmiecik

HTML

<link rel="stylesheet" href="http://davidwalsh.name/dw-content/jquery-ui-css/custom-theme/jquery-ui-1.7.2.custom.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
<input type="text" name="date" id="datepicker" size="12" />

JavaScript

$(document).ready(function ($) {
    var date_array = ["2022-06-13", "2022-06-17", "2022-06-19"];
    $("#datepicker").datepicker({
        //maxDate: new Date(),
        dateFormat: "yy-mm-dd",
        beforeShowDay: function (date) {
            if ($.inArray($.datepicker.formatDate('yy-mm-dd', date), date_array) > -1) {
                console.log('in')
                return [true, "", "Available"];
            } else {
                console.log('n')
                return [false, '', "Not Available"];
            }
        }
    });
});