title: Multidatespicker: Disable dates from a list
body: <p>I would like to use the following method, but use a list instead of a couple of dates.</p>
  
  <pre><code>addDisabledDates: [today.setDate(1), today.setDate(3)]
  </code></pre>
  
  <p>This is the code for my calender:</p>
  
  <blockquote>
    <p>$("#ExceptionDates").multiDatesPicker({</p>
  
  <pre><code>    defaultDate: "+1w",
      firstDay: 1,
      dateFormat: "dd.mm.yy",
      numberOfMonths: 1,
      **addDisabledDates: ['06/19/2012','06/20/2012'],** (NOT working)
      onSelect: function ()
      {
          var dates = $("#ExceptionDates").multiDatesPicker('getDates');
          var html = '';
          $.each(dates, function (i, val)
          {
              html += '&lt;input type="text" name="Dates" value="' + val + '"&gt;';
          });
  
          $("#SelectedDates").html(html);
      }
  });
  </code></pre>
  </blockquote>
  
  <p>This is the method to get the dates:</p>
  
  <pre><code>var getSelectedExceptionDates = function(callback)
  {
      $.ajax({
          type: "POST",
          url: "/Route/GetSelectedExceptionDates/",
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          success: function (response)
          {
              callback(response);
          },
          error: function (err)
          {
              console.log(err);
          }
      });
  
  };
  
  var callback = function (dates)
  {
      $.each(dates, function (i, date)
      {
          var splitDate = date.split('.');
  
      var day = splitDate[0];
      var month = splitDate[1];
      var year = splitDate[2];
  
      console.log(splitDate);
      console.log(new Date(year, (parseInt(month)-1).toString(), day));
  });
  
  };
  
  getSelectedExceptionDates(callback);
  </code></pre>
  
  <p>And this is what i get out by inspecting the site now:</p>
  
  <p>["12", "11", "2009"] General.js:101
  Thu Nov 12 2009 00:00:00 GMT+0100 (W. Europe Standard Time)</p>
  
  <p>Theres two different types cause im logging both atm.</p>
  
  <p>Any ideas how i can insert my list of dates into the addDisabledDates method?</p>
  
  <p><strong>EDIT: I got it working!</strong></p>
  
  <pre><code>var callback = function (dates)
      {
          var date_ary = new Array();
          $.each(dates, function (i, date)
          {
              var splitDate = date.split('.');
  
              var day = splitDate[0];
              var month = splitDate[1];
              var year = splitDate[2];
              date_ary.push(new Date(month + "/" + day + "/" + year));
          });
  
          console.log(date_ary);
  
          $("#ExceptionDates").multiDatesPicker({
              minDate: 0,
              defaultDate: "+1w",
              firstDay: 1,
              dateFormat: "dd.mm.yy",
              addDisabledDates: date_ary,
              numberOfMonths: 1,
              onSelect: function ()
              {
                  var dates = $("#ExceptionDates").multiDatesPicker('getDates');
                  var html = '';
                  $.each(dates, function (i, val)
                  {
                      html += '&lt;input type="text" name="Dates" value="' + val + '"&gt;';
                  });
  
                  $("#SelectedDates").html(html);
              }
          });
      };
      getSelectedExceptionDates(callback);
  
  var getSelectedExceptionDates = function (callback)
  {
      $.ajax({
          type: "POST",
          url: "/Route/GetSelectedExceptionDates/",
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          success: function (response)
          {
              callback(response);
          },
          error: function (err)
          {
              console.log(err);
          }
      });
  };
  </code></pre>