title: momentjs calculates date difference incorrectly
body: <p>In my angular web application, I want to compare two dates to see if a person is less than 18 years old when she/he entered the company. Here is the code I use to do this:</p>
  
  <pre><code>  const dayOfBirth = moment(formControl.value, this.dateFormat, true).startOf('day');
    const entranceDateControl = this.wizardFormGroup.get('entranceDate');
    const entranceDate = moment(entranceDateControl.value, this.dateFormat, true).startOf('day');
  
    // Check validation rule R3: Age is less than 18 compared to entrance date
    const difference = moment.duration(Math.abs(entranceDate.diff(dayOfBirth)));
    if (difference.years() &lt; 18) {
      const validationMessage = this.getValidationMessage('R3', formControlName);
      return validationMessage ? validationMessage.message : null;
    }
  </code></pre>
  
  <p>As you can see, I am using <code>startOf('day')</code> to get rid of any time component so that I only handle dates. I use <code>diff()</code> to get the difference between two dates and then <code>duration()</code> to convert the difference to years, months, days, etc. Using this code, the validation message should NOT show when the person is turning 18 years old on the day when she/he entered the company.</p>
  
  <p>Upon testing this, I came across what is, in my opinion, strange behavior. Depending on months and years used, it gave different results. For instance, for these dates it was Ok:</p>
  
  <pre><code>dayOfBirth   = 1998-03-01, 1998-04-01, ..., 2000-02-01
  entranceDate = 2016-03-01, 2016-04-01, ..., 2018-02-01
  </code></pre>
  
  <p>But the following dates returned the validation message:</p>
  
  <pre><code>dayOfBirth   = 2000-03-01, 2000-04-01, ..., 2002-02-01
  entranceDate = 2018-03-01, 2000-04-01, ..., 2020-02-01
  </code></pre>
  
  <p>After these dates, i.e. using <code>2002-03-01</code> and onward, it works again. I also got wrong result for the dates preceding <code>1998-03-01</code>.</p>
  
  <p>Now, I had a closer look at the Duration object and I noticed that for the times where it was less than 18 years, it had calculated 864 milliseconds <strong>less</strong> then when it came to the right conclusion that it was 18 years between the dates.</p>
  
  <pre><code>Correct duration
  ----------------
  dayOfBirth   = 1998-03-01, 1998-04-01, ..., 2000-02-01
  entranceDate = 2016-03-01, 2016-04-01, ..., 2018-02-01
  
  Duration = 568080000000 ms
  
  Wrong duration
  --------------
  dayOfBirth   = 2000-03-01, 2000-04-01, ..., 2002-02-01
  entranceDate = 2018-03-01, 2000-04-01, ..., 2020-02-01
  
  Duration = 567993600000 ms
  
  Duration difference
  -------------------
  568080000000 - 567993600000 = 86400000 ms = 24 hours = 1 day
  </code></pre>
  
  <p>Has anyone an explanation for this? Can it be considered a bug in momentjs? Any viable workaround for this?</p>