johntrepreneur johntrepreneur - 1 year ago 66
Javascript Question

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

Basically, I want to do a

myMoment >= yourMoment
. There is no
and writing that out combining
is a bit lengthy.

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

Answer Source

Okay, I just went with the moment.js .diff() function.

myMoment.diff(yourMoment) >= 0

Close enough.