// We initialize the Date() object with the current date and time
const date1 = new Date();
// We initialize a past date
const date2 = new Date('2018-04-07 12:30:00');
// Let's see if the first date is equal, more recent or less recent than the second date
if (date1.getTime() === date2.getTime()) {
console.log('The dates are equal');
}
else if (date1.getTime() > date2.getTime()) {
console.log(date1.toString() + ' is more recent than ' + date2.toString());
}
else {
console.log(date1.toString() + ' is less recent than ' + date2.toString());
}