changeset 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 45d0cd9388ea
children 4c808bfe0658
files iso8601.js
diffstat 1 files changed, 1 insertions(+), 10 deletions(-) [+]
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');
 };