jQuery UI Datepicker – Disable specific days

Here is a way to disable specific dates from being selected:

var unavailableDates = ["9-5-2011","14-5-2011","15-5-2011"];

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"];
  }
}

$('#iDate').datepicker({ beforeShowDay: unavailable });

Source: jQuery – Datepicker – Disable Specific Dates

Leave a Comment