title: Date within date range with JavaScript and Moment.js not evaluating correctly
body: <p>I apologize in advance if this seem like a stupid question, but I have never used Moment.js before.</p>
  
  <p>I have the following method (code inherited from previous developer), and cannot understand why the evaluation does not work. I am sure it is something trivial.</p>
  
  <p><strong>Note:</strong> only the dates <code>&gt;= weekOne</code> in the <code>if</code> statement evaluates the correct dates. The other <code>else if</code> clauses does not evaluate even when the dates match.</p>
  
  <pre><code>var myObject = $scope.uptimeData;
  var uptimeTotal = [];
  if (myObject) {
      var weekOne = moment().subtract(7, "days").format("YYYY-MM-DD");
      var weekTwo = moment().subtract(14, "days").format("YYYY-MM-DD");
      var weekThree = moment().subtract(21, "days").format("YYYY-MM-DD");
      var weekFour = moment().subtract(28, "days").format("YYYY-MM-DD");
      var weekFive = moment().subtract(35, "days").format("YYYY-MM-DD");
      var weekSix = moment().subtract(42, "days").format("YYYY-MM-DD");
      var weekSeven = moment().subtract(49, "days").format("YYYY-MM-DD");
  
      var weekOneTotalSuccess = 0;
      var weekTwoTotalSuccess = 0;
      var weekThreeTotalSuccess = 0;
      var weekFourTotalSuccess = 0;
      var weekFiveTotalSuccess = 0;
      var weekSixTotalSuccess = 0;
      var weekOneTotalFail = 0;
      var weekTwoTotalFail = 0;
      var weekThreeTotalFail = 0;
      var weekFourTotalFail = 0;
      var weekFiveTotalFail = 0;
      var weekSixTotalFail = 0;
      Object.keys(myObject).map(function (key, index) {
          if (myObject[key].successes) {
              if (key &gt;= weekOne) {
                  weekOneTotalSuccess = weekOneTotalSuccess + myObject[key].successes;
              } else if (key &gt;= weekTwo &amp;&amp; key &lt; weekThree) {
                  weekTwoTotalSuccess = weekTwoTotalSuccess + myObject[key].successes;
              } else if (key &gt;= weekThree &amp;&amp; key &lt; weekFour) {
                  weekThreeTotalSuccess = weekThreeTotalSuccess + myObject[key].successes;
              } else if (key &gt;= weekFour &amp;&amp; key &lt; weekFive) {
                  weekFourTotalSuccess = weekFourTotalSuccess + myObject[key].successes;
              } else if (key &gt;= weekFive &amp;&amp; key &lt; weekSix) {
                  weekFiveTotalSuccess = weekFiveTotalSuccess + myObject[key].successes;
              } else if (key &gt;= weekSix &amp;&amp; key &lt; weekSeven) {
                  weekSixTotalSuccess = weekSixTotalSuccess + myObject[key].successes;
              }
              else {
  
              }
          }
      }
  }
  </code></pre>
  
  <p><strong>Here is a sample of the data:</strong></p>
  
  <pre><code>"2017-05-03": {
    "failures": 816, 
    "successes": 18378
  }, 
  "2017-05-04": {
    "failures": 1067, 
    "successes": 22302
  }, 
  "2017-05-05": {
    "failures": 1008, 
    "successes": 82599
  }, 
  "2017-05-07": {
    "failures": 2724, 
    "successes": 142854
  }, 
  "2017-05-08": {
    "failures": 1329, 
    "successes": 149028
  }
  </code></pre>