momentJS minute comparison


#1

I want to do a minute by minute comparison and no more finer resolution than that, but the moment library returns seconds:

moment().toDate()
Tue May 10 2016 16:37:02 GMT+0100 (GMT Daylight Time)

and limiting to minutes resolution:

moment("2016-04-11 09:00").toDate()
Mon Apr 11 2016 09:00:00 GMT+0100 (GMT Daylight Time)

moment("2016-04-11 09:00", "YYYY-MM-DD HH:mm").toDate();
Mon Apr 11 2016 09:00:00 GMT+0100 (GMT Daylight Time)

still get seconds?

If doing a minute by minute comparison and by comparing seconds could skip equality depending on when job is started, so how to compare only as far as minutes resolution only?

if (present time == 15:00) then
etc

#2

http://momentjs.com/docs/#/manipulating/start-of/


#3

Hi Jesper

Thanks for the link, startOf seems to be the solution.