私は、date.js を使用して、ユーザー フレンドリーな文字列形式 (2006 年 7 月 1 日 12:34:14) で記述された日付と比較しています。私はこのコードを使用します。
function is_new(lasttime, newtime){
lasttime = Date.parse(lastime);
newtime = Date.parse(newtime);
if(lasttime.isBefore(newtime)){
return true;
}else{
return false;
}
}
lasttime と newtime はどちらも上記のような文字列です。これを試すと、
Uncaught TypeError: Object Tue Dec 30 1997 00:00:00 GMT+0000 (GMT Standard Time) has no method 'isBefore'