title: Moment.js - Duration within business/open/shift hours?
body: <p>thanks in advance for your help. I am trying to calculate the duration between two dates with moment.js, but I can't figure out how to only count time (in our case minutes) when it is within our business/open hours. </p>
  
  <p>Given these business hours: </p>
  
  <ul>
  <li>M-F from 8:00 AM to 6:00 PM</li>
  <li>Sa-Su from 10:00 AM to 2:00 PM </li>
  </ul>
  
  <p><strong>simple duration example</strong></p>
  
  <p>If a job starts Thu at 4:00 PM and ends Friday at 9:30 AM, then the duration is 210 minutes (4-6pm = 120 min, 8-9:30a = 90 min).  </p>
  
  <p><strong>less simple duration example</strong></p>
  
  <p>If a job started Thu at 4:00 PM and ended Saturday at 9:30 AM, then duration is 720 minutes (4-6pm = 120 min, 8a-6p = 600 min, time between Fri 6p and Sat 10a does not add to duration)</p>