In my case i did following code for compare 2 dates may it will help you ...
var date1 = "2010-10-20";_x000D_
var date2 = "2010-10-20";_x000D_
var time1 = moment(date1).format('YYYY-MM-DD');_x000D_
var time2 = moment(date2).format('YYYY-MM-DD');_x000D_
if(time2 > time1){_x000D_
console.log('date2 is Greter than date1');_x000D_
}else if(time2 > time1){_x000D_
console.log('date2 is Less than date1');_x000D_
}else{_x000D_
console.log('Both date are same');_x000D_
}
_x000D_
<script src="https://momentjs.com/downloads/moment.js"></script>
_x000D_