Javascript – How to do a greater than or equal to with moments (moment.js) in javascript

datedatetimejavascriptmomentjs

Basically, I want to do a myMoment >= yourMoment. There is no myMoment.isSameOrAfter and writing that out combining isSame and .isAfter is a bit lengthy.

What's the alternative? Convert moment to js date and use >= to compare?

Best Solution

You can use the isSameOrAfter method in momentjs:

moment1.isSameOrAfter(moment2);