When parsing cron expressions with fewer than five fields (such as three- or four-field expressions), the parser pads the missing fields incorrectly. This causes the parsed fields to be shifted into the wrong slots, lead…
When parsing cron expressions with fewer than five fields (such as three- or four-field expressions), the parser pads the missing fields incorrectly. This causes the parsed fields to be shifted into the wrong slots, leading to unexpected execution intervals (for example, firing every second instead of once per minute).
'20 15 * *' using CronExpressionParser.parse.stringify(true) to inspect the six-field representation.next() successively to calculate the interval between occurrences.stringify(true) should return '0 * 20 15 * *'.stringify(true) returns '* 0 20 15 * *'.This issue affects expressions with fewer than five fields. Standard five-field and six-field expressions are unaffected. This is a regression from version 4.x where short expressions were padded correctly with standard default fields.
Adapted from harrisiirak/cron-parser (MIT).
Visible test command
npm test -- --testPathPattern=visibleThe repository’s own tests. Run all tests includes them, and so does every submission.
Repository
short-cron-expressions-wrong-slots
Changes under src/ are evaluated.