Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library does not support '#' in cron expression #896

Closed
pratik-k2 opened this issue Oct 8, 2024 · 1 comment
Closed

Library does not support '#' in cron expression #896

pratik-k2 opened this issue Oct 8, 2024 · 1 comment

Comments

@pratik-k2
Copy link

Description

I passed 0 30 17 ? * 3#2 expression to trigger a process on 2nd Tuesday of every month at 5:30PM but the library throws exception CronError: Field (dayOfMonth) cannot be parsed.
Upon debugging, I found out that it the library does not honor '#' in the expression.

Expected Behavior

'#' should be be honored as its considered into cron expression.

Actual Behavior

Library throws exception when '#' is passed in cron expression: CronError: Field (dayOfMonth) cannot be parsed

Possible Fix

No response

Steps to Reproduce

Ue expression 0 30 17 ? * 3#2 in any code snippet using the library.

Context

I was trying to run a cron job.

Your Environment

  • cron version: 3.1.7
  • NodeJS version: 18.16.0
  • Operating System and version: macOS 14.6.1
  • TypeScript version (if applicable):
  • Link to your project (if applicable):
@sheerlox
Copy link
Collaborator

sheerlox commented Oct 8, 2024

This library respects the UNIX cron syntax (cronie's cron), which does not support the # symbol.

However, we do plan on supporting it at some point. You can find the existing feature request here:

In the meantime, you can add a check in your onTick function to only execute on the second Thursday.

@sheerlox sheerlox closed this as not planned Won't fix, can't repro, duplicate, stale Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants