]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Added tests for 24-hour time support.
authorIan Remmel <design@ianwremmel.com>
Mon, 9 Sep 2013 07:44:12 +0000 (21:44 -1000)
committerIan Remmel <design@ianwremmel.com>
Mon, 9 Sep 2013 07:44:12 +0000 (21:44 -1000)
test/moment/duration.js

index 10ec139f0bd18eef54a4e7e82e5fdb945ca4f38c..434c4faa493a85b9c695c0bfc5983ec7da04177c 100644 (file)
@@ -139,6 +139,28 @@ exports.duration = {
         test.done();
     },
 
+    "instantiation from 24-hour time zero" : function(test) {
+       test.expect(6);
+       test.equal(moment.duration("00:00").years(), 0, "0 years");
+       test.equal(moment.duration("00:00").days(), 0, "0 days");
+       test.equal(moment.duration("00:00").hours(), 0, "0 hours");
+       test.equal(moment.duration("00:00").minutes(), 0, "0 minutes");
+       test.equal(moment.duration("00:00").seconds(), 0, "0 seconds");
+       test.equal(moment.duration("00:00").milliseconds(), 0, "0 milliseconds");
+       test.done();
+    },
+
+     "instantiation from 24-hour time" : function(test) {
+       test.expect(6);
+       test.equal(moment.duration("13:45").years(), 0, "0 years");
+       test.equal(moment.duration("13:45").days(), 0, "0 days");
+       test.equal(moment.duration("13:45").hours(), 13, "13 hours");
+       test.equal(moment.duration("13:45").minutes(), 45, "45 minutes");
+       test.equal(moment.duration("13:45").seconds(), 0, "0 seconds");
+       test.equal(moment.duration("13:45").milliseconds(), 0, "0 milliseconds");
+       test.done();
+    },
+
     "instatiation from serialized C# TimeSpan zero" : function (test) {
         test.expect(6);
         test.equal(moment.duration("00:00:00").years(), 0, "0 years");