From 7361f01273fd877f1ca8a6dc054a8570f718f170 Mon Sep 17 00:00:00 2001 From: oziee Date: Sat, 1 Feb 2014 17:01:19 +1000 Subject: [PATCH] Update later.js was failing with test var newDate = new Date('2014-02-28'); later.schedule({schedules: [{D:[1], M:[2], Y:[2014]},{D_a:[27], D_b:[29], M:[2], Y:[2014]}], exceptions: []}).isValid(newDate); return !b || a.getTime() > b.getTime(); <-- a is null and so a.getTime() is blowing up Bills fix is working a treat so far --- later.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/later.js b/later.js index 2cdbb58..e2ddbe9 100644 --- a/later.js +++ b/later.js @@ -763,9 +763,9 @@ later = function() { } function compareFn(dir) { return dir === "next" ? function(a, b) { - return !b || a.getTime() > b.getTime(); + return !a ? true : (!b || a.getTime() > b.getTime()); } : function(a, b) { - return !a || b.getTime() > a.getTime(); + return !b ? true : (!a || b.getTime() > a.getTime()); }; } function findNext(arr, compare) { @@ -1506,4 +1506,4 @@ later = function() { return parseScheduleExpr(str.toLowerCase()); }; return later; -}(); \ No newline at end of file +}();