question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does not support cron range (',','-')

See original GitHub issue

The package doesn’t seem to support cron statement w/ range syntax, such as "00 00 * * * 6-7" or "00 00 * * * 6,7", is this a bug or feature request?

Behavior noticed using the following…

Version: 2.4.1

Environment:

Local time: Sun 2017-07-02 13:59:22 PDT
Universal time: Sun 2017-07-02 20:59:22 UTC
RTC time: Sun 2017-07-02 20:59:22
Time zone: America/Los_Angeles (PDT, -0700)

Repro:

// expected
00 00 * * * 6-7 2017-07-02T14:00:00-07:00
00 00 * * * 7 2017-07-02T14:00:00-07:00
00 00 * * * 6,7 2017-07-02T14:00:00-07:00

// actual
00 00 * * * 6-7 2017-07-08T00:00:00-07:00
00 00 * * * 7 2017-07-02T14:00:00-07:00
00 00 * * * 6,7 2017-07-08T00:00:00-07:00

Script (using moment-timezone for clarity):

const cronParser = require("cron-parser");
const moment = require("moment-timezone");

let timezone = "America/Los_Angeles"
let patterns = [
  "00 00 * * * 6-7",
  "00 00 * * * 7",
  "00 00 * * * 6,7",
];
let args = { 
  iterator: true,
  currentDate: '2017-07-02T13:25:00-07:00',
  tz: timezone,
};

patterns.forEach((pattern) => {
  let iterator = cronParser.parseExpression(pattern, args);
  let next = moment(iterator.next().value.toISOString()).tz(timezone).format();
  console.log(pattern, next);
});

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
harrisiirakcommented, May 15, 2018

@BuZzy1337 haven’t really had time to look into this. It’s still top priority tho. Trying to look into this as soon as possible. Thank you reminding this!

1reaction
BuZZy1337commented, May 15, 2018

Any solution in sight for this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Will crontab hour range a-b run after b too? - Stack Overflow
cron will run jobs when the time matches the expression provided. Your expression tells it to run when the minute is divisible by...
Read more >
12.3 Understanding Cron Syntax in the Job Scheduler
The cron triggers you can configure in the Orchestration Server Job ... HINT:When you use the L option, be careful not to specify...
Read more >
Reference: Cron and rate expressions for Systems Manager
(State Manager doesn't currently support specifying months in cron expressions for associations.) ... The - (dash) wildcard specifies ranges.
Read more >
Why is my crontab not working, and how can I troubleshoot it?
Cron is all things considered a very basic scheduler and the syntax does not easily allow an administrator to formulate slightly more uncommon...
Read more >
New in Spring 5.3: Improved Cron Expressions
Use the first three letters of the particular day or month (case does not matter). Here are some examples: Cron Expression, Meaning. 0...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found