Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-schedule

Package Overview
Dependencies
Maintainers
4
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-schedule - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

every_second.js

29

lib/schedule.js

@@ -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();
}
}
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc