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

fields.dayOfWeek = [1,3,5] generates incorrect cron expression #310

Closed
klumba12 opened this issue Feb 20, 2023 · 5 comments · Fixed by #312
Closed

fields.dayOfWeek = [1,3,5] generates incorrect cron expression #310

klumba12 opened this issue Feb 20, 2023 · 5 comments · Fixed by #312
Assignees
Labels

Comments

@klumba12
Copy link

example: https://stackblitz.com/edit/typescript-playground-spjybj?file=index.ts

const at10amMonWenFri = parser.parseExpression('0 0 10 * 1,3,5');
const cron = parser.fieldsToExpression(at10amMonWenFri.fields).stringify(true);

// expected origin 0 0 10 * 1,3,5
// but cron equals to 0 0 10 * 1/2 
// when dow is 1/2  - Sundays are included in the generated dates
console.log(cron);
@abberadhi
Copy link

abberadhi commented Feb 26, 2023

Hey, I can confirm I experience this issue as well. Feels like an issue related to the compactor. Please fix.

@harrisiirak
Copy link
Owner

Hi @klumba12 and @abberadhi!

Thanks for reporting and confirming this. It seems to be caused by the bugfix in #295. I'll revisit this and see if there is better fix for initial bug.

Best regards

@harrisiirak
Copy link
Owner

@klumba12 and @abberadhi created a quick fix Draft-PR: #312
Let me know how it working for you. Shortly, stringify should now retain original value where needed and only optimise multiple values based field when it makes sense.

@klumba12
Copy link
Author

klumba12 commented Mar 1, 2023

hi @harrisiirak, looks great! thank you

@d00rsfan
Copy link

d00rsfan commented Mar 5, 2023

Hi!
--there was notexisting bug report, sorry --

P.S. is it correct way to test with branche? just npm install https://github.com/harrisiirak/cron-parser#fix/stringify-range-step-handling

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

Successfully merging a pull request may close this issue.

4 participants