title: Get all time slots (and exclude some) between two dates using moment.js (infinite loop issue ?)
body: <p>I'm a kind of newbie, and I'm trying (using <code>moment.js</code>) to get all timeslots between two dates excluding some. More precisely.</p>
  
  <ul>
  <li>I have a <code>start date</code> (say monday) and  <code>end date</code> (say wednesday)</li>
  <li>I want to get an <code>array</code> of all 30 minutes slots (monday 00:00, monday 00:30... tuesday 9:00, tuesday 09:30, tuesday 10:00...)</li>
  <li><strong>But</strong> excluding - for example - slots before 9AM...</li>
  </ul>
  
  <hr>
  
  <pre><code>const dates = []
  
  const now = moment(now).startOf('day').hour(9).minute(0).seconds(0)
  const deadline = moment(end).hour(19).minute(0).seconds(0)    
  
  while (now.diff(deadline) &lt; 0) {
    if (now &gt; now.hour(9)) {
      dates.push(now.format('YYYY-MM-DD HH:mm'))
    }
    now.add(30, 'minutes')
  }
  </code></pre>
  
  <p>Without <code>if</code> statement, things work (my array contains all days between my two dates). But with <code>if</code>, my browser <strong>crashes</strong> (infinite loop?).
  But I do not know why... Any idea? I'd liked to learn...</p>