bradymholt / cRonstrue

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

Incomplete cron expressions with '/' fail silently #259

Closed Zsar closed 1 year ago

Zsar commented 1 year ago

cRonstrue treats the incomplete value /5 as valid, but silently fails to parse it:

cronstrue.toString("/5 * * * *", {
  throwExceptionOnParseError: true,
  verbose: true,
  locale: "en",
})

produces the string "Every 5 minutes, starting at  minutes past the hour, every hour, every day" - note the double whitespace in front of "minutes".

Expected: throws

Reproduced in versions 2.14.0 and 1.125.0 .

Note: 5/ also does not throw but is silently treated as 5... that may actually be fair.

bradymholt commented 1 year ago

/5 * * * * does not appear to be a valid expression.

Please see FAQ re: invalid expressions: https://github.com/bradymholt/cRonstrue#frequently-asked-questions

Zsar commented 1 year ago

Very well. Figured that, given the output is malformed, it's worth a report anyway.