floraison / fugit

time tools (cron, parsing, durations, ...) for Ruby, rufus-scheduler, and flor
MIT License
355 stars 29 forks source link

too many loops in #next_time/previous_time for invalid dates #21

Closed hspazio closed 5 years ago

hspazio commented 5 years ago

Issue description

This is again a known issue reporting as per error message. Although the input date is incorrect (e.g. Feb 31st) the :parse method returns a valid object and the loop :next_time reaches the max number of iterations.

How to reproduce

require 'fugit'
c = Fugit.parse('0 12 31 2 *')
p c.next_time

Same issue occurs with all inputs that have month within 1-12 and day within 1-31 but are not valid dates:

Suggestions

jmettraux commented 5 years ago

gh-20

jmettraux commented 5 years ago

https://crontab.guru/#*_*_31_2_* is valid, crond probably never schedules (and doesn't fail with a RuntimeError).

jmettraux commented 5 years ago

Thanks!

hspazio commented 5 years ago

Thank you @jmettraux! much appreciated your quick turnaround! :)

jmettraux commented 5 years ago

You're welcome :-)