bradymholt / cRonstrue

JavaScript library that translates Cron expressions into human readable descriptions
http://bradymholt.github.io/cRonstrue/
MIT License
1.31k stars 169 forks source link

For cron expression 0 8 */80 * *, At 08:00 AM, every 80 days text is not correct #192

Closed kaushalnavneet closed 3 years ago

kaushalnavneet commented 3 years ago

This issue is caught in a Timed Trigger type for a Tekton pipeline. When I set the cron expression 0 8 */80 * * for a job and it shows At 08:00 AM, every 80 days there. But actually, there is no such cron expression that will work for every 80 days. The expression above means At 08:00 on every 80th day-of-month, but eventually, this job runs on the 1st of every month. We could probably improve the description of the cron expression there. Since we use cronstrue as an external package to generate the cron description strings. I'd like to raise an issue since the At 08:00 AM, every 80 days text is not correct. (FYI, we use cron-validator to validate the cron expression and it also doesn't consider it as an incorrect expression). If the frequency of the day (like in this example 80) exceeds the length of that month (28/30/31), it should show when the actual frequency happens (that is 1st day of the next month), not on every 80 days. PS: Tested with the latest version, it doesn't seem to address this issue.

bradymholt commented 3 years ago

Per FAQ, cRonstrue doesn't try to validate cron expressions. Garbage in — garage out. I would recommend validating an expression before passing it into cRonstrue. It sounds like a tweak in cron-validator might be a good route here.