我收到一个错误,它只出现在出色的 IE8 上,它指向以下函数,特别是行:return (expDate.getTime() > Date.now());
$.validator.addMethod("checkDocExpiry",function(value) {
var driverLicExp = ($('#drivers-license-expiration').val()) ? $('#drivers-license-expiration').val() : '';
if (driverLicExp != ''){
var expDate = new Date(driverLicExp);
return (expDate.getTime() > Date.now());
}else{
return (true);
}
}, "Your driver's license has expired.");
我不确定是什么原因导致的,我对为旧版浏览器进行开发还很陌生。这在 FF、IE10、Chrome、Safari 中运行良好。
如有任何帮助,我们将不胜感激。
谢谢
最佳答案
看起来 IE8 不支持 Date.now()
(见底部的表格):
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now
new Date()
应该会为您提供一个包含当前日期的日期对象。
关于javascript - IE8 : Object Doesn't Support This Property or Method (Date function),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18068517/