Javascript uses unix timestamps in milliseconds, so it looks like strtotime output (which uses seconds).
var date = new Date();
Then you will need to perform the calculation in milliseconds. (Minutes * 60 * 1000)
You can also use date.parse() to parse a string in milliseconds, just like strtotime() in PHP does up to seconds.
In full:
var date = new Date(); var last = new Date('Previous Date');
You can use a static date to compare just time, this is exactly what strtotime does if you exclude the date:
var last = new Date('1/1/70 14:10:00'); var date = new Date('1/1/70 14:30:00');
However, this approach will not succeed if you are trying to compare time crossing the borders of the day.
source share