I have a problem with this code in google chrome and firefox. this.setUTCDate(1);
throws Uncaught TypeError: this is not a Date object. How can I fix it?
I've looked at this and this, but I didn't find anything to solve my problem.
Date.prototype.setUTCDateOnly = function(date) {
var tmp = new Date(date);
this.setUTCDate(1);
};
I am calling it in this way:
var date = Date.prototype.setUTCDateOnly(item.date);