]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Removing 'now' option on min/max 800/head
authorTim Wood <washwithcare@gmail.com>
Mon, 3 Jun 2013 17:21:27 +0000 (10:21 -0700)
committerTim Wood <washwithcare@gmail.com>
Mon, 3 Jun 2013 17:21:27 +0000 (10:21 -0700)
moment.js
test/moment/min_max.js

index 1adf58d21acabaa9ae09ca2b603963ff2c961696..52bd737ab74e2fe40689dbbcc68d1ab57a6365e8 100644 (file)
--- a/moment.js
+++ b/moment.js
         },
 
         min: function (other) {
-            if (typeof other === "string" && other.toLowerCase() === "now") {
-                other = moment();
-            } else {
-                other = moment.apply(null, arguments);
-            }
+            other = moment.apply(null, arguments);
             return other < this ? this : other;
         },
 
         max: function (other) {
-            if (typeof other === "string" && other.toLowerCase() === "now") {
-                other = moment();
-            } else {
-                other = moment.apply(null, arguments);
-            }
+            other = moment.apply(null, arguments);
             return other > this ? this : other;
         },
 
index 9ede27ce5ade558ba670613222aaf1b73d1aab08..da75c485a75b491732591e4a80c02757b8a7f6cc 100644 (file)
@@ -12,7 +12,7 @@ exports.min_max = {
     },
 
     "min" : function (test) {
-        test.expect(10);
+        test.expect(8);
 
         var now = moment(),
             future = now.clone().add(1, 'month'),
@@ -22,12 +22,10 @@ exports.min_max = {
         // two moments are off by a millisecond.
 
         test.ok(Math.abs(past.min(now).diff(now)) < 2,        "A past date with the minimum of now should be now");
-        test.ok(Math.abs(past.min('now').diff(now)) < 2,      "A past date with the minimum of 'now' should be now");
         test.ok(Math.abs(past.min().diff(now)) < 2,           "A past date with the minimum of implied now should be now");
         test.ok(Math.abs(past.min(future).diff(future)) < 2,  "A past date with the minimum of the future should be the future date");
 
         test.ok(Math.abs(future.min(now).diff(future)) < 2,   "A future date with the minimum of now should be the future");
-        test.ok(Math.abs(future.min('now').diff(future)) < 2, "A future date with the minimum of 'now' should be the future");
         test.ok(Math.abs(future.min().diff(future)) < 2,      "A future date with the minimum of implied now should be the future");
         test.ok(Math.abs(future.min(past).diff(future)) < 2,  "A future date with the minimum of the past should be the future");
 
@@ -38,7 +36,7 @@ exports.min_max = {
     },
 
     "max" : function (test) {
-        test.expect(10);
+        test.expect(8);
 
         var now = moment(),
             future = now.clone().add(1, 'month'),
@@ -48,12 +46,10 @@ exports.min_max = {
         // two moments are off by a millisecond.
 
         test.ok(Math.abs(past.max(now).diff(past)) < 2,    "A past date with the maximum of now should be the past");
-        test.ok(Math.abs(past.max('now').diff(past)) < 2,  "A past date with the maximum of 'now' should be the past");
         test.ok(Math.abs(past.max().diff(past)) < 2,       "A past date with the maximum of implied now should be the past");
         test.ok(Math.abs(past.max(future).diff(past)) < 2, "A past date with the maximum of the future should be the past");
 
         test.ok(Math.abs(future.max(now).diff(now)) < 2,    "A future date with the maximum of now should be now");
-        test.ok(Math.abs(future.max('now').diff(now)) < 2,  "A future date with the maximum of 'now' should be now");
         test.ok(Math.abs(future.max().diff(now)) < 2,       "A future date with the maximum of implied now should be now");
         test.ok(Math.abs(future.max(past).diff(past)) < 2,  "A future date with the maximum of the past should be the past");