cron-validator icon indicating copy to clipboard operation
cron-validator copied to clipboard

Wrong validation

Open ganjarsetia opened this issue 2 years ago • 2 comments

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:

  • Python 3.9.15
  • cron-validator==1.0.8

ganjarsetia avatar Oct 05 '23 04:10 ganjarsetia

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

mj2608 avatar May 15 '24 12:05 mj2608