diff 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
line wrap: on
line diff
--- a/iso8601.js
+++ b/iso8601.js
@@ -34,14 +34,5 @@ Date.prototype.setFromISO8601 = function
 };
 
 Date.prototype.toString = function () {
-	var pad = function (n) {
-		return ((n < 10)? '0': '') + n;
-	};
-
-	return this.getUTCFullYear() +
-		"-" + pad(this.getUTCMonth() + 1) +
-		"-" + pad(this.getUTCDate()) +
-		"T" + pad(this.getUTCHours()) +
-		":" + pad(this.getUTCMinutes()) +
-		":" + pad(this.getUTCSeconds()) + 'Z';
+	return this.toISOString().replace(/\....Z$/, 'Z');
 };