我有一个日期 const date1 = "2020-08-08"
我想检查这个日期是在今天之前还是之后
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")
}
以上代码无法正常工作,但我正在尝试类似的操作。有什么办法吗?