【发布时间】:2014-09-27 02:39:38
【问题描述】:
我的 Web 应用程序需要一个特定的日期值。我更改了 Date 原型。但它不是 Jquery Date 的有效日期。
InitDate = Date;
InitDate.prototype = Date.prototype;
Date = function () {
if (arguments.length == 0) {
var now = new InitDate();
var date = new InitDate(2013, 8, 3);
date.setHours(now.getHours());
date.setMinutes(now.getMinutes());
date.setSeconds(now.getSeconds());
date.setMilliseconds(now.getMilliseconds());
date.prototype = Date.prototype;
return date;
}
else {
var date = InitDate.apply(this, arguments);
return date;
}
};
Date.prototype = InitDate.prototype;
错误:
“未捕获的 TypeError:这不是 Date 对象。”
如何更改 Javascript 日期对象?
【问题讨论】:
标签: javascript jquery datetime datepicker