node-schedule
Advanced tools
Comparing version 0.5.1 to 0.6.0
@@ -18,2 +18,8 @@ | ||
function isValidDate(date) { | ||
// Taken from http://stackoverflow.com/a/12372720/1562178 | ||
// If getTime() returns NaN it'll return false anyway | ||
return date.getTime() === date.getTime(); | ||
} | ||
function Job(name, job, callback) { | ||
@@ -167,3 +173,3 @@ // setup a private pendingInvocations variable | ||
if (spec instanceof Date) { | ||
if ((spec instanceof Date) && (isValidDate(spec))) { | ||
inv = new Invocation(self, spec); | ||
@@ -170,0 +176,0 @@ scheduleInvocation(inv); |
{ | ||
"name": "node-schedule", | ||
"version": "0.5.1", | ||
"version": "0.6.0", | ||
"description": "A cron-like and not-cron-like job scheduler for Node.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -49,2 +49,12 @@ | ||
clock.tick(1250); | ||
}, | ||
"Should not accept invalid string as valid date": function(test) { | ||
test.expect(1); | ||
var job = schedule.scheduleJob("hello!!", function() { | ||
}); | ||
test.equal(job, null); | ||
test.done(); | ||
} | ||
@@ -51,0 +61,0 @@ }, |
51440
1537