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

Could it be the numerical values for day of week are off by one? #113

Open
Thorongil80 opened this issue Nov 28, 2022 · 3 comments
Open

Comments

@Thorongil80
Copy link

Hi,

I use job_scheduler https://docs.rs/job_scheduler/latest/job_scheduler/ which apparently pulls cron 0.6.1 as dependency.

I noticed that this expression

0 0 17 * * Mon-Sat

is not

0 0 17 * * 1-6

Which according to crontab format however, it should be. The latter expression would fire on Sundays till Friday.

Are you one off in the numerical format for day-of-week?

Or were you one off back then with 0.6.1?

Should I ask job_scheduler to bump to newer version? I opened an issue with them lholden/job_scheduler#29

Best Regards,
Thomas

@BlackDex
Copy link
Contributor

This crate isn't crontab compatible. For one, this crate supports seconds, which crontab doesn't allow at all.
Looking at the code, it uses 1 for Sunday, and 7 for Saturday.

"sun" | "sunday" => 1,
"mon" | "monday" => 2,
"tue" | "tues" | "tuesday" => 3,
"wed" | "wednesday" => 4,
"thu" | "thurs" | "thursday" => 5,
"fri" | "friday" => 6,
"sat" | "saturday" => 7,

There is nothing other crates can do which implement this crate besides trying to catch the format and change it manually. But that will only lead into issues with people already using this format.

@makerio90
Copy link

are there plans to add some sort of chrontab support?

@zslayton
Copy link
Owner

zslayton commented Feb 8, 2023

Please see this issue. This crate was coded against the Quartz scheduling engine's cron syntax specification. Unfortunately, there is no single definitive standard.

I'm open to supporting various standards via a builder/config API, but I don't have the bandwidth to work on this crate actively.

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

4 participants