kaka2507 / cron-validator

unix cron implementation in Python
MIT License
25 stars 9 forks source link

Wrong validation #15

Open ganjarsetia opened 11 months ago

ganjarsetia commented 11 months ago

I want to run cron at every 5th minute past every hour from 11pm through 11am. And this is the schedule */5 0-11,23 * * *. When I run this code

from cron_validator import CronValidator
CronValidator.parse('*/5 0-11,23 * * *')

I got error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/cron_validator/validator.py", line 23, in parse
    raise ValueError(f"Invalid expression part {i}")
ValueError: Invalid expression part 1

I think its a bug.

I tried using crontab.guru and this lib in nodejs https://github.com/GuillaumeRochat/cron-validator it all valid.

I'm using:

mj2608 commented 3 months ago

Facing same issue with another cron schedule - 10-20,50-55 0-6 *.

I think it doesn't validate when there is a list of ranges or list of range and specific