title: Uncaught TypeError: Cannot read property '0' of undefined jquery datepicker
body: <p>I have the following jQuery code for datepicker and I'm getting the error <code>Uncaught TypeError: Cannot read property '0' of undefined</code>. 
  I want to do some computations in the beforeShowDay callback but because of this error I'm unable to do so. I'm using jQuery 1.10.2 and jQuery-ui 1.10.4</p>
  
  <p>I found a similar question but none of the solutions seems to be working:</p>
  
  <p><a href="https://stackoverflow.com/questions/16698368/datepicker-error-uncaught-typeerror-cannot-read-property-0-of-undefined">datepicker Error = Uncaught TypeError: Cannot read property &#39;0&#39; of undefined</a></p>
  
  <pre><code>$(document).ready(function(){
    $("#inline_datepicker").datepicker({
              dateFormat: "yy-mm-dd",
              minDate: 0,
              onSelect: function(){
                  fetch_time_slots($(this).datepicker("getDate"));
              },
              beforeShowDay: function(date){
                  console.log(date)
              }
      });
  });
  </code></pre>