You attempted to invoke the Date.prototype.toString or Date.prototype.valueOf method on an object of a type other than Date. The object of this type of invocation must be of type Date. For example:
var o = new Object; o.f = Date.prototype.toString; o.f();
To correct this error
Only invoke the Date.prototype.toString or Date.prototype.valueOf methods on objects of type Date.