Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
hspazio opened this issue May 2, 2019 · 5 comments
Closed

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

hspazio opened this issue May 2, 2019 · 5 comments
Assignees

Comments

@hspazio
Copy link

hspazio commented May 2, 2019

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:

  • Feb 30th
  • Feb 31st
  • Apr 31st
  • Jun 31st
  • Sep 31st
  • Nov 31st

Suggestions

  • Could the parse method return nil directly when invalid combination of month-day is detected?
@jmettraux jmettraux self-assigned this May 2, 2019
@jmettraux
Copy link
Member

gh-20

@jmettraux
Copy link
Member

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

jmettraux added a commit that referenced this issue May 3, 2019
@jmettraux
Copy link
Member

Thanks!

@hspazio
Copy link
Author

hspazio commented May 7, 2019

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

@jmettraux
Copy link
Member

You're welcome :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants