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

cron-parser

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cron-parser - npm Package Compare versions

Comparing version 2.11.0 to 2.12.0

2

component.json

@@ -5,3 +5,3 @@ {

"description": "Node.js library for parsing crontab instructions",
"version": "2.11.0",
"version": "2.12.0",
"keywords": ["cron", "crontab", "parser"],

@@ -8,0 +8,0 @@ "dependencies": {},

@@ -788,11 +788,13 @@ 'use strict';

// Validate max daysInMonth value when explicit use
// Filter out any day of month value that is larger than given month expects
if (mappedFields.month.length === 1) {
var daysInMonth = CronExpression.daysInMonth[mappedFields.month[0] - 1];
var maxDayInMonthValue = Math.max.apply(null, mappedFields.dayOfMonth);
var isWildCardDayInMonth = isWildcardRange(mappedFields.dayOfMonth, CronExpression.constraints[3]);
if (!isWildCardDayInMonth && maxDayInMonthValue > daysInMonth) {
if (mappedFields.dayOfMonth[0] > daysInMonth) {
throw new Error('Invalid explicit day of month definition');
}
mappedFields.dayOfMonth = mappedFields.dayOfMonth.filter(function(dayOfMonth) {
return dayOfMonth <= daysInMonth;
});
}

@@ -799,0 +801,0 @@

{
"name": "cron-parser",
"version": "2.11.0",
"version": "2.12.0",
"description": "Node.js library for parsing crontab instructions",

@@ -46,7 +46,7 @@ "main": "lib/parser.js",

"is-nan": "^1.2.1",
"moment-timezone": "^0.5.23"
"moment-timezone": "^0.5.25"
},
"devDependencies": {
"sinon": "^7.2.7",
"tap": "^12.6.0"
"sinon": "^7.3.2",
"tap": "^14.2.2"
},

@@ -53,0 +53,0 @@ "engines": {

@@ -410,8 +410,5 @@ var test = require('tap').test;

// TODO: Currently, encountering an out-of-range failure (as above)
// still results in a new interval being set on the object.
// Until/unless this is fixed, the below test will fail.
// next = interval.prev();
// t.equal(next.getHours(), 16, 'Hour matches');
// t.equal(next.getMinutes(), 20, 'Minute matches');
next = interval.prev();
t.equal(next.getHours(), 16, 'Hour matches');
t.equal(next.getMinutes(), 20, 'Minute matches');

@@ -613,2 +610,43 @@ interval.reset();

test('expression using explicit month definition and */5 day of month step', function(t) {
var firstIterator = CronExpression.parse('0 12 */5 6 *', {
currentDate: '2019-06-01T11:00:00.000'
});
var firstExpectedDates = [
new CronDate('2019-06-01T12:00:00.000'),
new CronDate('2019-06-06T12:00:00.000'),
new CronDate('2019-06-11T12:00:00.000'),
new CronDate('2019-06-16T12:00:00.000'),
new CronDate('2019-06-21T12:00:00.000'),
new CronDate('2019-06-26T12:00:00.000'),
new CronDate('2020-06-01T12:00:00.000')
];
firstExpectedDates.forEach(function(expectedDate) {
t.equal(expectedDate.toISOString(), firstIterator.next().toISOString());
});
var secondIterator = CronExpression.parse('0 15 */5 5 *', {
currentDate: '2019-05-01T11:00:00.000'
});
var secondExpectedDates = [
new CronDate('2019-05-01T15:00:00.000'),
new CronDate('2019-05-06T15:00:00.000'),
new CronDate('2019-05-11T15:00:00.000'),
new CronDate('2019-05-16T15:00:00.000'),
new CronDate('2019-05-21T15:00:00.000'),
new CronDate('2019-05-26T15:00:00.000'),
new CronDate('2019-05-31T15:00:00.000'),
new CronDate('2020-05-01T15:00:00.000')
];
secondExpectedDates.forEach(function(expectedDate) {
t.equal(expectedDate.toISOString(), secondIterator.next().toISOString());
});
t.end();
});
test('day of month and week are both set', function(t) {

@@ -730,2 +768,3 @@ try {

test('day of month and week are both set and dow is 7', function(t) {

@@ -1260,1 +1299,2 @@ try {

});
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