title: How to calculate Number of 'Working days' between two dates in Javascript using moment.js?
body: <p>How to calculate the number of working days between two dates in JavaScript using moment.js. I have a working formula that calculate these days, but the formula does not satisfies all conditions:</p>
  
  <p>here is my code:</p>
  
  <pre><code>var start= moment(data[x].start_date);
                  var end= moment(data[x].est_end_date);
                  var difference= end.diff(start, 'days');
                  var workingDays= Math.round((difference/7)*5);
  //data[x] is for iterating over a loop
  </code></pre>
  
  <p>I get five days per 7 days here because saturday and sunday are considered as NON-Working days, but this formula will fail if the count of the days were started from sunday or saturday.</p>
  
  <p>Please any one could help in this regard that what necessary changes must be done in order to avoid this problem.</p>