Skip to content

docs(readme): add day of month and day of week OR condition behavior#1040

Open
hackertaco wants to merge 1 commit intokelektiv:mainfrom
hackertaco:docs/clarify-day-of-month-day-of-week-or-condition
Open

docs(readme): add day of month and day of week OR condition behavior#1040
hackertaco wants to merge 1 commit intokelektiv:mainfrom
hackertaco:docs/clarify-day-of-month-day-of-week-or-condition

Conversation

@hackertaco
Copy link

Summary

  • Clarifies that when both day of month and day of week fields are specified with specific values (not *), they create an OR condition (not AND), following standard POSIX cron behavior
  • Adds examples to illustrate the behavior
  • Mentions the # character syntax being considered in feat: [435] add support for extended cron syntax #877 as an alternative for patterns like "first Monday of the month"

Closes #890

Copilot AI review requested due to automatic review settings January 25, 2026 12:50
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds important documentation clarifying the OR condition behavior when both day of month and day of week fields are specified in cron expressions. This addresses a common misunderstanding documented in issue #890 where users expected an AND condition but got OR behavior, which is the standard POSIX cron behavior.

Changes:

  • Adds explanation of OR vs AND behavior for day of month and day of week fields in the Gotchas section
  • Provides concrete examples to illustrate the OR condition behavior
  • References PR #877 for future extended cron syntax support using the # character for patterns like "first Monday of the month"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

README.md Outdated
- `0 0 1-7 * 1` means "run at midnight on days 1-7 **OR** on any Monday", not "run on Mondays that fall within days 1-7".
- `0 0 15 * 5` means "run on the 15th of any month **OR** on any Friday".

If either field is set to `*` (unrestricted), the relationship becomes AND:
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The phrase "the relationship becomes AND" is misleading. When one field is set to *, that field is unrestricted and doesn't impose any constraint - there's no AND relationship happening. The job simply matches based on the restricted field alone. Consider rephrasing to something like: "If either field is set to * (unrestricted), only the other field's constraint applies:"

Suggested change
If either field is set to `*` (unrestricted), the relationship becomes AND:
If either field is set to `*` (unrestricted), only the other field's constraint applies:

Copilot uses AI. Check for mistakes.
Clarifies that when both fields are specified with specific values,
they create an OR condition (not AND), following standard POSIX cron behavior.

Also mentions the # character syntax being considered in kelektiv#877 as an
alternative for patterns like "first Monday of the month".

Closes kelektiv#890

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@hackertaco hackertaco force-pushed the docs/clarify-day-of-month-day-of-week-or-condition branch from a94d8ef to cdaae2a Compare January 25, 2026 12:56
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

Successfully merging this pull request may close these issues.

Incorrect Behavior in Setting Up a Cron Job for First Monday of the Month

1 participant