I have two dates, 1 being new Date();
and another Date in the same format, I would like to check if another Date is within 1 minute.
For example if I have the Date Sun Feb 25 2018 21:57:44 GMT+0000 (GMT Standard Time)
, anything between Sun Feb 25 2018 21:56:44 GMT+0000 (GMT Standard Time)
and Sun Feb 25 2018 21:58:44 GMT+0000 (GMT Standard Time)
would count as true
.
I have tried to converting it to an ISOString and then slicing it down to the 2nd integer of the minutes and comparing them like so:
parseInt(new Date().toISOString().slice(0, 16).split(':')[1]);
but I think that's inefficient, and it doesn't consider the day/date/hour.
How would I go about doing this?