1
如何只能用下面的片段来比较日期如何使用datepicker JQuery比较“仅日期;不是时间”?
var selectedDate = $("input[id='accountDate']").datepicker('getDate');
if (selectedDate != null) {
var now = new Date();
console.log("selectedDate:" + selectedDate + " | now: " + now)
if (selectedDate < now) {
do this and this and this
}
}
}
日志输出:
selectedDate (Entered Date):Tue Sep 01 2015 00:00:00 GMT+0200 (W. Europe Standard Time)
| now: Tue Sep 01 2015 09:43:33 GMT+0200 (W. Europe Standard Time)
正如你在输出日期看到的是相同的还是它正在执行(selectedDate <现在);它不应该。我认为这是由于时间问题。
我们如何比较日期(不是时间)?
感谢。让我尝试 – fatherazrael