Step 1: To use moment's methods, you need to convert Date object or string to moment object:
Let's say we have:
let firstDate = "03/17/2010 00:09:12 PM"
let secondDate = "03/18/2010 00:09:12Z"
Convert them to moment object:
firstDate = moment(firstDate)
secondDate = moment(secondDate)
Step 2: Check for moment methods and use the one that you need. In this case, I would recommend using isSameOrAfter to compare and diff to get the difference between moment objects:
const isFirstDateBeforeSecondDate = firstDate.isSameOrAfter(secondDate)
const differentBetweenTwoDates = firstDate.diff(secondDate, 'days')
In short:
const isFirstDateBeforeSecondDate = moment(firstDate).isSameOrAfter(moment(secondDate))
const differentBetweenTwoDates = moment(firstDate).diff(moment(secondDate), 'days'))