comparison iso8601.js @ 38:5395a501c991

Use internal toISOString method of Data.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 16 Nov 2010 19:00:15 +0100
parents e007a6364bf0
children 023f767662d3
comparison
equal deleted inserted replaced
37:45d0cd9388ea 38:5395a501c991
32 32
33 return this; 33 return this;
34 }; 34 };
35 35
36 Date.prototype.toString = function () { 36 Date.prototype.toString = function () {
37 var pad = function (n) { 37 return this.toISOString().replace(/\....Z$/, 'Z');
38 return ((n < 10)? '0': '') + n;
39 };
40
41 return this.getUTCFullYear() +
42 "-" + pad(this.getUTCMonth() + 1) +
43 "-" + pad(this.getUTCDate()) +
44 "T" + pad(this.getUTCHours()) +
45 ":" + pad(this.getUTCMinutes()) +
46 ":" + pad(this.getUTCSeconds()) + 'Z';
47 }; 38 };