]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Fixing moment.utc(number). #323
authorTim Wood <washwithcare@gmail.com>
Thu, 31 May 2012 23:03:45 +0000 (16:03 -0700)
committerTim Wood <washwithcare@gmail.com>
Thu, 31 May 2012 23:03:45 +0000 (16:03 -0700)
moment.js
test/moment/create.js

index 54d97e291a7c4d38669c1985cddedc698051ee68..003154a8a72b0920bebba47b5f06d77e4e73da2c 100644 (file)
--- a/moment.js
+++ b/moment.js
         }
         return (format && input) ?
             moment(input + ' +0000', format + ' Z').utc() :
-            moment(input && !parseTokenTimezone.exec(input) ? input + '+0000' : input).utc();
+            moment(input && isoRegex.exec(input) && !parseTokenTimezone.exec(input) ? input + '+0000' : input).utc();
     };
 
     // creating with unix timestamp (in seconds)
index d806dd8137ea660e113343f8d38ce4cc183b2257..9b70cfe86518a0774ec87ef62d8e6a3355f97691 100644 (file)
@@ -15,9 +15,10 @@ exports.create = {
     },
 
     "number" : function(test) {
-        test.expect(2);
+        test.expect(3);
         test.ok(moment(1000).toDate() instanceof Date, "1000");
         test.ok((moment(1000).valueOf() === 1000), "testing valueOf");
+        test.ok((moment.utc(1000).valueOf() === 1000), "testing valueOf");
         test.done();
     },