Skip to content

Parse cron expressions with Vixie cron's rules - #18

Merged
justintout merged 1 commit into
bug/nicknames-and-unsatisfiablefrom
bug/match-vixie-parsing
Oct 3, 2026
Merged

justintout merged 1 commit into
bug/nicknames-and-unsatisfiablefrom
bug/match-vixie-parsing

Conversation

@justintout

Copy link
Copy Markdown
Owner

Stacked on #17. GitHub will retarget this to main once #17 merges.

Fields are now parsed once into sets of values. isValid and Cron share that parse, which replaces the per-field string validators and the per-minute string matching.

Changes to match Vixie cron:

  • Fields are separated by any run of spaces or tabs. Leading and trailing whitespace is ignored.
  • Steps are allowed inside lists: 1-10/2,20-30/5.
  • * may appear in a list: *,5.
  • Month names work in lists and ranges: jan-mar, jan,feb.
  • Sunday is both 0 and 7. sun is 0 at the start of a range and 7 at the end, so sun-sat and fri-sun are both valid. A numeric 5-0 stays invalid.
  • A day field that starts with *, such as */2, counts as unrestricted for the day rule, so the two day fields combine with AND. 0 0 13 * */2 now runs only on a 13th that is an even weekday.

Still rejected, as in Vixie: a single value with a step (5/2), names as steps, and empty list elements.

Two fixture rows flip from invalid to valid: 1,10-15/15 and 1,10-12/3.

Fields are now parsed once into sets of values, shared by isValid and
Cron. The parser follows Vixie cron where the old one differed:

- Fields are separated by any run of spaces or tabs.
- Steps are allowed inside lists: 1-10/2,20-30/5.
- * may appear in a list, and names work in month lists and ranges.
- Sunday is both 0 and 7: sun-sat and fri-sun are both valid.
- A day field that starts with *, such as */2, is unrestricted for the
  day-of-month/day-of-week rule, so the two fields combine with AND.
@justintout
justintout merged commit 5daed5c into bug/nicknames-and-unsatisfiable Oct 3, 2026
1 check passed
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.

1 participant