In pure JS, this would be how.
How can I find out the number of minutes since midnight for a given moment object (without extracting to Date
moment
Date
This is what I have at the moment:
if (!moment.isMoment(mmt)) { return 0; } var hh = mmt.get('hour'); var mm = mmt.get('minute'); return hh*60 + mm;
I am not sure if it takes into account various edge cases; comment if this is the case, or provide an alternate answer.