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
This post is available on GitHub.
Posted .

Comments

Leave a Reply