我想获取当前日期(天,小时,分钟,秒钟),并将其放入一个if()语句中与输入的日期进行比较。但是,我该如何在代码中获取日期并要求它呢?
目前我已经有了以下代码:
bot.on("ready", () => {
var today = new Date();
var date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate();
var time = today.getHours() + ":" + today.getMinutes();
var currentdate = date + time
var endDate = new Date('2021-01-21T14:00:00')
if (endDate = currentdate) {
console.log('The time has come..')
} else {
console.log('The time is coming soon..')
}
})