adhocore / gronx

Lightweight, fast and dependency-free Cron expression parser (due checker, next/prev due date finder), task runner, job scheduler and/or daemon for Golang (tested on v1.13+) and standalone usage. If you are bold, use it to replace crontab entirely.
https://github.com/adhocore/gronx
MIT License
422 stars 25 forks source link

`NextTick` fails with `00 * * * *` #29

Closed millotp closed 1 year ago

millotp commented 1 year ago

Hi,

I encountered a weird situation where

(it's the same with 00 in the hour segment)

I'm not sure which scenario is correct, because some cron validator online says this is valid and other don't, so should IsValid return true or should NextTick work with this expression ? Thanks !

adhocore commented 1 year ago

thanks for ticket. 00 is wrong, no? i think 00 should be KO right away with error

millotp commented 1 year ago

It seems to work fine on crontab.guru and other website, in fact they accept any number of 0

millotp commented 1 year ago

If you want IsValid to be false for that case I can open a PR if you want

adhocore commented 1 year ago

yep, but what does the spec say? i dont know, need to look that up lol :D if 00 is equivalent to 0 then we can do so as per specification. if not we can error :)

millotp commented 1 year ago

According to most resources, leading zero are allowed but not required:

so I guess it's up to you 🤷‍♂️

adhocore commented 1 year ago

thanks it is more upto spec i think. :) i would appreciate a PR allowing 00. 👍

(it was late yesterday in my timezone)