title: Do calculations with bootstrap datepicker
body: <p>in my web page, I have some date fields and they are assigned with <code>Bootstrap datepicker</code>. In a <code>javascript</code> function I need to get the date of a field called <code>onBookingDate</code>. I can get it like this. </p>
  
  <pre><code>var on_BookingDate =  jQuery('#datepick_onBooking').val();
  </code></pre>
  
  <p>Then I need to add 8 months to it and then compare the new date value with another date value which is retrieved using the above method. This is the code I used. (All the dates are in the form of <code>dd-mm-yyyy</code>)</p>
  
  <pre><code>var on_BookingDate =  jQuery('#datepick_onBooking').val();
  var dateArray = on_BookingDate.split("-");
  //dateArray[1] contains the month value
  
  var dateObj = new Date(dateArray[2], dateArray[1] - 1, dateArray[0]);
  dateObj.setMonth(dateObj.getMonth() + 8);
  var intFreeLastDate = dateObj.getDate() + "-" + (dateObj.getMonth() + 1) + "-" + dateObj.getFullYear();
  </code></pre>
  
  <p>In order to compare dates, they have to be time values. For that </p>
  
  <ol>
  <li><code>.datepicker('getDate')</code></li>
  <li><code>getTime()</code></li>
  </ol>
  
  <p>have to be used. But when I tried </p>
  
  <pre><code>var int_free_last_date = intFreeLastDate.datepicker('getDate');
  alert("int free last date get date = "+int_free_last_date);
  </code></pre>
  
  <p>I get following error,</p>
  
  <pre><code>Uncaught TypeError: undefined is not a function
  </code></pre>
  
  <p>Why is this? and how to fix this. Isn't the <code>int_free_last_date</code> in date format required??</p>
  
  <p><strong>JS FIddle</strong> <a href="http://jsfiddle.net/Lnmvc5ao/" rel="nofollow">http://jsfiddle.net/Lnmvc5ao/</a></p>