I'm given a date const date1 = "2020-08-08"
I want to check whether this date is before today or after today
const date1 = "2020-08-08"
const today = new Date()
if(date1 > new Date) {
console.log("date1 is the future")
} else {
console.log("date1 is the past")
}
The above code doesn't work but I am trying to do something like that. Is there a way?