harrisiirak/cron-parser

v4.8.0 fields.dayOfWeek = [1,3,5,6] generates incorrect cron expression

klumba12 opened this issue · 1 comments

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

example

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

// expected origin 0 0 10 * 1,3,5,6
// but cron equals to 0 0 10 * 1,3,5,6,6
console.log(cron);

Hi @klumba12!

Thanks for reporting this, it's a bug indeed! I overlooked how multiple ranges (1,3,5,6 is internally parsed into 2 distinct ranges) are serialised. I've fix ready and I'll try to release it later today as as 4.8.1.

Best regards