P4sca1 / cron-schedule

A zero-dependency cron parser and scheduler for Node.js, Deno and the browser.
MIT License
172 stars 14 forks source link

fix: Sundays can begin weekday ranges #320

Closed tehpsalmist closed 1 month ago

tehpsalmist commented 1 month ago

This PR fixes a bug where weekday ranges starting with sun would incorrectly throw an out of order error.

For example:

parseCronExpression('00 12 * * Sun-wed,fri')
// Throws -- parse error: Error: Failed to parse Sun-wed: Invalid range (start: 7, end: 3).

Tests were also updated to check for:

  1. the case outlined above, and
  2. to ensure that sun-sun was not treated as a full week range, but only as a single day. I couldn't find the spec for this, but instead very scientifically tried it out at crontab.guru to see what it would yield.
P4sca1 commented 1 month ago

Hey @tehpsalmist, thank you for your contribution and for also including additional test cases. I will review asap.

P4sca1 commented 1 month ago

:tada: This issue has been resolved in version 5.0.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

tehpsalmist commented 1 month ago

Thanks for the quick review and release! Have a blessed week!