title: Sorting date using moment angular is not working
body: <p>I have a method to sortDate which is called in Angular ts file.</p>
  <pre><code>import * as moment from 'moment';     
  sortDate(a,b){
          const dateIsAfter = moment(a).isAfter(moment(b));
          const dateIsSame = moment(a).isSame(moment(b));
          const dateIsBefore = moment(a).isBefore(moment(b));
          if(dateIsAfter) {
            console.log('Input Date 1 :',a, ' Input Date 2: ',b ,' Returned dateIsAfter:',-1 * this.sortOrder );
            return -1 * this.sortOrder;
          }else if(dateIsBefore) {
            console.log('Input Date 1 :',a, ' Input Date 2: ',b ,' Returned dateIsBefore:',1 * this.sortOrder );
            return 1 * this.sortOrder;
          }else{
            return 0 * this.sortOrder;
          }
        }
  </code></pre>
  <p>The sortDate method is called:</p>
  <pre><code>this.sortDate(new Date(a[column]), new Date(b[column]));
  </code></pre>
  <p>My output in console:
  <a href="https://i.stack.imgur.com/Jccxs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jccxs.png" alt="enter image description here" /></a></p>
  <p>Sorting works perfectly fine for year 2021. But, when trying to verify with 2022 as highlighted Oct 08 2021 should come after Mar 2022. But, it returns First dateisAfter which is incorrect, as a result Mar 2022 which should be above, goes down. Again, everything in Mar 2022 is sorted perfectly fine. Why is this behaviour.</p>
  <p><a href="https://i.stack.imgur.com/WdJOL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WdJOL.png" alt="enter image description here" /></a></p>
  <p>When using below sortDate() method it works fine in chrome. However it's not working in firefox</p>
  <pre><code>sortDate(a,b){
         return new Date(a).getTime() - new Date(b).getTime()
  }
  </code></pre>
  <p>Output in chrome:
  <a href="https://i.stack.imgur.com/5qj8d.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5qj8d.png" alt="enter image description here" /></a></p>
  <p>Output on firefox:</p>
  <p><a href="https://i.stack.imgur.com/dJyah.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dJyah.png" alt="enter image description here" /></a></p>