jQuery UI Datepicker: Block all Dates Except Specific Ones

This may seem rather backwards to how jQuery UI Datepicer is created to work, but is there a way to modify the script to block ALL days (including weekends) except for dates within a variable?

If not, I’m using this tutorial to create a script for disabling dates, which is great—there’s just a lot of dates to disable for most of the year. I’m able to disable dates, but I can’t get both calendars to include weekends to be disabled. Granted this simple remark: jQ.datepicker.noWeekends would work, but I need to somehow integrate it within the ‘unavailable’ function that I have.

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

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.