var a = new Date;
console.log(a.toJSON());
I want modify the Date.prototype.toJSON to increment the value of a by xxx minutes and after do what it do. I write this code but run in recursion:
var Date_toJSON = Date.prototype.toJSON;
Date.prototype.toJSON = function() {
return Date_toJSON.call(new Date(this.getTime() + (60 * 1000)));
}
I want to do this because JSON.strignify don' t count timezone differences. So, must modify Date.prototype.toJSON to change the (this) value by: (this.getTimezoneOffset() * 60 * 1000) (1 hour)eg.
Can somebody show me the right way to do this?