The code invoked 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.
To correct this error
-
Only invoke the Date.prototype.toString or Date.prototype.valueOf methods on objects of type Date.