Socket
Socket
Sign inDemoInstall

cron

Package Overview
Dependencies
0
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.3 to 1.0.4

39

lib/cron.js

@@ -124,5 +124,5 @@ var CronDate;

while (1) {
var diff = date - start;
var diff = date - start,
origDate = new Date(date);
if (!(date.getMonth() in this.month)) {

@@ -147,2 +147,6 @@ date.setMonth(date.getMonth() + 1);

date.setMinutes(0);
date.setSeconds(0);
if (date <= origDate) {
date = this._findDST(origDate);
}
continue;

@@ -152,4 +156,9 @@ }

if (!(date.getHours() in this.hour)) {
origDate = new Date(date);
date.setHours(date.getHours() == 23 && diff > 24 * 60 * 60 * 1000 ? 0 : date.getHours() + 1);
date.setMinutes(0);
date.setSeconds(0);
if (date <= origDate) {
date = this._findDST(origDate);
}
continue;

@@ -159,4 +168,8 @@ }

if (!(date.getMinutes() in this.minute)) {
origDate = new Date(date);
date.setMinutes(date.getMinutes() == 59 && diff > 60 * 60 * 1000 ? 0 : date.getMinutes() + 1);
date.setSeconds(0);
if (date <= origDate) {
date = this._findDST(origDate);
}
continue;

@@ -166,3 +179,7 @@ }

if (!(date.getSeconds() in this.second)) {
origDate = new Date(date);
date.setSeconds(date.getSeconds() == 59 && diff > 60 * 1000 ? 0 : date.getSeconds() + 1);
if (date <= origDate) {
date = this._findDST(origDate);
}
continue;

@@ -178,2 +195,15 @@ }

/**
* get next date that is a valid DST date
*/
_findDST: function(date) {
var newDate = new Date(date),
addSeconds = 1;
while (newDate <= date) {
newDate.setSeconds(date.getSeconds() + addSeconds++);
}
return newDate;
},
/**
* wildcard, or all params in array (for to string)

@@ -398,3 +428,3 @@ */

this.stop();
}
}
},

@@ -406,3 +436,4 @@

stop: function() {
clearTimeout(this._timeout);
if (this._timeout)
clearTimeout(this._timeout);
this.running = false;

@@ -409,0 +440,0 @@ if (this.onComplete) this.onComplete();

2

package.json
{
"name": "cron",
"description": "Cron jobs for your node",
"version": "1.0.3",
"version": "1.0.4",
"author": "Nick Campbell <nicholas.j.campbell@gmail.com> (http://github.com/ncb000gt)",

@@ -6,0 +6,0 @@ "bugs" : {

@@ -51,2 +51,14 @@ node-cron

Cron Ranges
==========
When specifying your cron values you'll need to make sure that your values fall within the ranges. For instance, some cron's use a 0-7 range for the day of week where both 0 and 7 represent Sunday. We do not.
* Seconds: 0-59
* Minutes: 0-59
* Hours: 0-23
* Day of Month: 1-31
* Months: 0-11
* Day of Week: 0-6
Another cron example

@@ -53,0 +65,0 @@ ==========

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc