The below should work properly, and for all browsers (thanks to @MattJohnson for the tip)
Date.prototype.toIsoString = function() {_x000D_
var tzo = -this.getTimezoneOffset(),_x000D_
dif = tzo >= 0 ? '+' : '-',_x000D_
pad = function(num) {_x000D_
var norm = Math.floor(Math.abs(num));_x000D_
return (norm < 10 ? '0' : '') + norm;_x000D_
};_x000D_
return this.getFullYear() +_x000D_
'-' + pad(this.getMonth() + 1) +_x000D_
'-' + pad(this.getDate()) +_x000D_
'T' + pad(this.getHours()) +_x000D_
':' + pad(this.getMinutes()) +_x000D_
':' + pad(this.getSeconds()) +_x000D_
dif + pad(tzo / 60) +_x000D_
':' + pad(tzo % 60);_x000D_
}_x000D_
_x000D_
var dt = new Date();_x000D_
console.log(dt.toIsoString());
_x000D_