What is wrong with the code below?(以下代码有什么问题?)
Maybe it would be simpler to just compare date and not time.(也许只比较日期而不是时间会更简单。)
I am not sure how to do this either, and I searched, but I couldn't find my exact problem.(我也不知道该怎么做,我进行了搜索,但找不到确切的问题。)
BTW, when I display the two dates in an alert, they show as exactly the same.(顺便说一句,当我在警报中显示两个日期时,它们显示为完全相同。)
My code:(我的代码:)
window.addEvent('domready', function() {
var now = new Date();
var input = $('datum').getValue();
var dateArray = input.split('/');
var userMonth = parseInt(dateArray[1])-1;
var userDate = new Date();
userDate.setFullYear(dateArray[2], userMonth, dateArray[0], now.getHours(), now.getMinutes(), now.getSeconds(), now.getMilliseconds());
if (userDate > now)
{
alert(now + '
' + userDate);
}
});
Is there a simpler way to compare dates and not including the time?(有没有比较日期而不包括时间的简单方法?)
ask by moleculezz translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…