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

Repeatable day of month not working when providing day of week #347

Open
dhulke opened this issue Apr 3, 2024 · 0 comments
Open

Repeatable day of month not working when providing day of week #347

dhulke opened this issue Apr 3, 2024 · 0 comments

Comments

@dhulke
Copy link

dhulke commented Apr 3, 2024

The first set of next() calls are working as expected, but when I change the cron expression to filter by day of week, the results become unpredictable. Could this be related to this other issue #284 where 1-5 is being treated as a wild card match?

const parser = require('cron-parser');

const intervalEveryDay = parser.parseExpression('0 0 */3 * *');

console.log('Every day');
console.log('Date: ', intervalEveryDay.next().toString()); // Thu Apr 04 2024 00:00:00 GMT-0300 (Brasilia Standard Time)
console.log('Date: ', intervalEveryDay.next().toString()); // Sun Apr 07 2024 00:00:00 GMT-0300 (Brasilia Standard Time)
console.log('Date: ', intervalEveryDay.next().toString()); // Wed Apr 10 2024 00:00:00 GMT-0300 (Brasilia Standard Time)
console.log('Date: ', intervalEveryDay.next().toString()); // Sat Apr 13 2024 00:00:00 GMT-0300 (Brasilia Standard Time)

const intervalWeekDay = parser.parseExpression('0 0 */3 * 1-5');

console.log('Week days');
console.log('Date: ', intervalWeekDay.next().toString()); // Thu Apr 04 2024 00:00:00 GMT-0300 (Brasilia Standard Time)
console.log('Date: ', intervalWeekDay.next().toString()); // Fri Apr 05 2024 00:00:00 GMT-0300 (Brasilia Standard Time)
console.log('Date: ', intervalWeekDay.next().toString()); // Sun Apr 07 2024 00:00:00 GMT-0300 (Brasilia Standard Time)
console.log('Date: ', intervalWeekDay.next().toString()); // Mon Apr 08 2024 00:00:00 GMT-0300 (Brasilia Standard Time)\
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

1 participant