In this article, you will learn how to compare two dates in JavaScript
var date = new Date();
console.log(date.getTime());
setTimeout(()=>{
var date1 = new Date();
console.log(date1.getTime());
},500);
How to compare two dates in JavaScript
minify code