node-schedule
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -326,3 +326,6 @@ | ||
var now = new Date(); | ||
if (this.year !== null && (typeof this.year == 'number') && this.year < now.getFullYear()) { | ||
var fullYear = now.getFullYear(); | ||
if ((this.year !== null) && | ||
(typeof this.year == 'number') && | ||
(this.year < fullYear)) { | ||
return null; | ||
@@ -335,10 +338,18 @@ } | ||
while (true) { | ||
if (this.year != null && !recurMatch(next.getFullYear(), this.year)) { | ||
next.addYear(); | ||
next.setMonth(0); | ||
next.setDate(1); | ||
next.setHours(0); | ||
next.setMinutes(0); | ||
next.setSeconds(0); | ||
continue; | ||
if (this.year !== null) { | ||
fullYear = next.getFullYear(); | ||
if ((typeof this.year == 'number') && (this.year < fullYear)) { | ||
next = null; | ||
break; | ||
} | ||
if (!recurMatch(fullYear, this.year)) { | ||
next.addYear(); | ||
next.setMonth(0); | ||
next.setDate(1); | ||
next.setHours(0); | ||
next.setMinutes(0); | ||
next.setSeconds(0); | ||
continue; | ||
} | ||
} | ||
@@ -345,0 +356,0 @@ if (this.month != null && !recurMatch(next.getMonth(), this.month)) { |
{ | ||
"name": "node-schedule", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "A cron-like and not-cron-like job scheduler for Node.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -6,7 +6,18 @@ | ||
var schedule = require('../' + main); | ||
var sinon = require('sinon'); | ||
var clock; | ||
// 12:30:15 pm Thursday 29 April 2010 in the timezone this code is being run in | ||
var base = new Date(2010, 3, 29, 12, 30, 15, 0); | ||
var baseMs = base.getTime(); | ||
module.exports = { | ||
"setUp": function(cb) { | ||
clock = sinon.useFakeTimers(baseMs); | ||
cb(); | ||
}, | ||
"tearDown": function(cb) { | ||
clock.restore(); | ||
cb(); | ||
}, | ||
"#nextInvocationDate(Date)": { | ||
@@ -262,4 +273,24 @@ "next second": function(test) { | ||
test.done(); | ||
}, | ||
"With the year set should not loop indefinetely": function(test) { | ||
var rule = new schedule.RecurrenceRule(); | ||
rule.second = 0; | ||
rule.minute = 0; | ||
rule.hour = 0; | ||
rule.date = 1; | ||
rule.month = 5; | ||
rule.year = 2010; | ||
var next; | ||
var base1 = new Date(2010, 4, 31, 12, 30, 15, 0); | ||
next = rule.nextInvocationDate(base1); | ||
test.deepEqual(new Date(2010, 5, 1, 0, 0, 0, 0), next); | ||
next = rule.nextInvocationDate(next); | ||
test.equal(next, null); | ||
test.done(); | ||
} | ||
} | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17
1915
60647
1
0