JavaScript compare dates

Compare two dates in JavaScript.

var now = new Date();
var past = new Date('2020-01-01');
console.log(past.getTime() < now.getTime());
true

Comments

Leave a Reply