title: moment.js - test if a date is today, yesterday, within a week or two weeks ago
body: <p>I am trying with moment.js to know if a date is today, yesterday, 1 week ago, or older (2 weeks ago or more).</p>
  
  <p>I already done that for the first two cases:</p>
  
  <pre><code>var today = moment().startOf('day');
  var yesterday = moment().subtract(1, 'days').startOf('day');
  
  if (moment(localTime).isSame(today, 'd')) // today
      // do something
  if (moment(localTime).isSame(yesterday, 'd')) // yesterday
      // do something
  </code></pre>
  
  <p>Is that correct?</p>
  
  <p>However, how could I check if a date is a week ago, or older (eg. two weeks ago)?</p>