moment diff 2 dates output code example
Example 1: moment diff
const dateDifference = moment(date1).diff(moment(date2))
Example 2: compare two dates using moment
moment('2010-10-20').isAfter('2010-01-01', 'year'); // false
moment('2010-10-20').isAfter('2009-12-31', 'year'); // true