title: Determine if the date is today or is in the past using MomentJS?
body: <p>Im building a mini calendar that just displays the current month, I have figured out how to map out the calendar, here is the code:</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>var month  = moment(),
      index  = 0,
      maxDay = month.daysInMonth(),
      start  = month.startOf("month"),
      offset = (start.isoWeekday() - 1 + 7) % 7; // start from monday
  
  var week = []; // holds the weeks
  var days = []; // holds the days
  
  do {
  
    var dayIndex = index - offset;
  
    if(dayIndex &gt;= 0 &amp;&amp; dayIndex &lt; maxDay){
      days.push({
                number: dayIndex + 1,
                isPast: null,  // stuck here boolean
                isToday: null  // stuck here boolean 
       })
    }
  
    if(index % 7 === 6){
      week.push(days);
      console.log(week);
      days = [];
  
       if (dayIndex + 1 &gt;= maxDay) {
            break;
       }
    }
  
   index += 1;
  } while(true);
  </code></pre>
  
  <p>This works fine, the only issue Im having is to figure out if the day  is today or its in the past?</p>
  
  <p>the code is here also: <a href="https://jsfiddle.net/chghb3Lq/3/" rel="nofollow noreferrer">https://jsfiddle.net/chghb3Lq/3/</a></p>