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

Improved documentation around "day_of_week" 0/1 confusion #931

Open
1 task done
charlienewey-odin opened this issue Jul 1, 2024 · 1 comment
Open
1 task done

Comments

@charlienewey-odin
Copy link

charlienewey-odin commented Jul 1, 2024

Things to check first

  • I have searched the existing issues and didn't find my feature already requested there

Feature description

I think the day_of_week field mapping between days and integers in the CronTrigger class is confusing and violates the principle of least astonishment. The CronTrigger is clearly named after the cron Unix tool, which, by convention, uses the integer 0 to refer to Sunday - however, the apscheduler implementation uses 0 as Monday. This nuance is not very clearly documented and this causes confusion to people migrating from e.g. cron.

While the decision to use 0 as Monday is not strictly a bug in itself (although given the choice, I would have taken a different approach when implementing the class), I personally found the documentation to be unclear and the subsequent application behaviour to be confusing. I had to resort to reading the code to validate the CronTrigger's behaviour when I was debugging a task.

I plan to add a PR to improve the docs if I get some time.

Use case

Having clearer documentation of potential "expectation violations" will help reduce the friction experienced by developers when using the CronTrigger class.

@agronholm
Copy link
Owner

The 4.0 series of releases already changed 0 to mean Sunday. I could not do that in 3.x since it would have broken backwards compatibility. Do you need a documentation update for the 3.x series then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants