title: How do I find the days between two dates in JavaScript or jQuery datepicker?
body: <p>I am using jQuery datepicker. In my application, I have <code>startDate</code> and <code>endDate</code> date ranges. </p>
  
  <p>If my date range is less than a week(7 days), I need to disable some day textbox's. Please see the image below</p>
  
  <p><strong>Expected output:</strong>
  <a href="https://i.stack.imgur.com/C65ap.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C65ap.png" alt="Expected Output"></a></p>
  
  <p>I can able to get the number of days difference between to dates like this;</p>
  
  <pre><code>var startDate = $('#startDate').datepicker('getDate');
  var endDate = $('#endDate').datepicker('getDate');
  //find difference between start and end date
  var noOfDays = Math.ceil((startDate - startDate) / (1000 * 60 * 60 * 24));
  </code></pre>
  
  <p>If <code>noOfDays</code> is less than 7 days, I need to disable the day textbox according to the date range. For that I need list days between date ranges.</p>
  
  <p>According to my example image <code>Mon</code> and <code>Sun</code> should be disabled.</p>
  
  <p><code>['Tue','Wed','Thu','Fri','Sat']</code> or corresponding UTC day values <code>['1','2','3','4','5']</code> should be enabled.</p>
  
  <p>Can anyone guide me to get day values?</p>