title: jQuery UI datepicker - disable public holidays, weekends, next day after 10am AND only allow Tuesday, Wednesday & Thursday as selectable days
body: <p>I'm using the code from <a href="https://stackoverflow.com/questions/17526592/jquery-ui-datepicker-disbale-next-day-after-12pm">JQuery UI Datepicker Disbale Next Day After 12pm</a> to disable weekends, public holidays and next day (if selected after 10am), but I'm stuck on how to only allow Tuesday, Wednesday and Thursday to be selected.</p>
  
  <pre><code>// dates
  var dateMin = new Date();
  var weekDays = AddWeekDays(1);
  dateMin.setDate(dateMin.getDate() + weekDays);
  var natDays = [
    [1, 1, 'uk'],
    [12, 25, 'uk'],
    [12, 26, 'uk']
  ];
  function noWeekendsOrHolidays(date) {
      var noWeekend = $j.datepicker.noWeekends(date);
      if (noWeekend[0]) {
          return nationalDays(date);
      } else {
          return noWeekend;
      }
  }
  function nationalDays(date) {
      for (i = 0; i &lt; natDays.length; i++) {
          if (date.getMonth() == natDays[i][0] - 1 &amp;&amp; date.getDate() == natDays[i][1]) {
              return [false, natDays[i][2] + '_day'];
          }
      }
      return [true, ''];
  }
  function AddWeekDays(weekDaysToAdd) {
      var mydate = new Date();
      if (mydate.getHours()&gt;=10) 
      var daysToAdd = 1;
      else var daysToAdd = 0;
      var day = mydate.getDay()
      weekDaysToAdd = weekDaysToAdd - (5 - day)
      if ((5 - day) &lt; weekDaysToAdd || weekDaysToAdd == 1) {
          daysToAdd = (5 - day) + 2 + daysToAdd
      } else { // (5-day) &gt;= weekDaysToAdd
          daysToAdd = (5 - day) + daysToAdd
      }
      while (weekDaysToAdd != 0) {
          var week = weekDaysToAdd - 5
          if (week &gt; 0) {
              daysToAdd = 7 + daysToAdd
              weekDaysToAdd = weekDaysToAdd - 5
          } else { // week &lt; 0
              daysToAdd = (5 + week) + daysToAdd
              weekDaysToAdd = weekDaysToAdd - (5 + week)
          }
      }
  
      return daysToAdd;
  }   
  
  $j('.input-text.addon.addon-custom').datepicker({
      beforeShowDay: noWeekendsOrHolidays,
      minDate : dateMin,
      defaultDate: +1,
      firstDay: 1,
      changeFirstDay: true,
      dateFormat: "DD, dd MM yy"
  });
  </code></pre>
  
  <p>Any help would be very much appreciated.</p>
  
  <p>Fiddle here: <a href="http://jsfiddle.net/prydonian/4k4gga6j/" rel="nofollow">http://jsfiddle.net/prydonian/4k4gga6j/</a></p>