0

I'm trying to diable specific days of the week and some specific dates using a script, and echoing the dates from the database with php, this is what I came to so far

  <script>
$(function() {
   var unavailableDates = ["1-1-2022"];

    function unavailable(date) {
        dmy = date.getDate() + "-" + (date.getMonth() + 1) + "-" + date.getFullYear();
        if ($.inArray(dmy, unavailableDates) == -1) {
            return [true, ""];
        } else {
            return [false, "", "Unavailable"];
        }
    }

    $(function() {
        $("#datepicker").datepicker({
            dateFormat: 'dd MM yy',
            minDate: 0,
            beforeShowDay: unavailable
        });

    });
});
 $("#datepicker").datepicker(
        { beforeShowDay: function(day) {
            var day = day.getDay();
            if (day == 0 || day == 1) {
                return [false, "somecssclass"]
            } else {
                return [true, "someothercssclass"]
            }
         }
        });
  </script>
  • Does this answer your question? [jQuery Date Picker- Block a future date range](https://stackoverflow.com/questions/70148456/jquery-date-picker-block-a-future-date-range) – SKJ Dec 17 '21 at 14:37
  • Does this answer your question? [Jquery UI datepicker. Disable array of Dates](https://stackoverflow.com/questions/15400775/jquery-ui-datepicker-disable-array-of-dates/15400806) – user12031119 Dec 17 '21 at 14:42

0 Answers0