You can clone with
Would you accept these additions if I made them?
aMoment.isBefore(otherMoment); //=> true or false
aMoment.isAfter(otherMoment); //=> true or false
aMoment.compareTo(otherMoment); //=> -1,0, or 1
If so, do you think it would be best to wrap the parameter with a moment(otherMoment) call so you could pass in strings too? My bias is to do exactly that.
You can just do moment(a) > moment(b). The valueOf prototype method makes this possible.
TIL. That's pretty cool on JS's part, and it's a bit weird that I didn't know that. Glad I asked before writing the code.
Yeah, I end up using it a lot with arithmetic functions, like in moment.fn.diff.
Here's some cool articles where I first learned about valueOf.