Advertisement
pjmakey2

MomentJSBdays

Mar 24th, 2021
803
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const getBusinessDays = (startDate, endDate) => {
  2.   let days = Math.round(startDate.diff(endDate, 'days') - startDate .diff(endDate, 'days') / 7 * 2);
  3.   if (endDate.day() === 6) {
  4.     days--;
  5.   }
  6.   if (startDate.day() === 7) {
  7.     days--;
  8.   }
  9.   return Math.abs(days);
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement