-
Notifications
You must be signed in to change notification settings - Fork 114
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
Unexpected behavior and infinite loops when using 24:00 #113
Comments
First of all the result Then I will fix the infinite loop bug. But unless you can explain why it's incorrect, the outputs will not change. |
In fact the infinite loop is not a bug neither but a rather a not supported case. As it's continuously open every day, we cannot find the next close and so the next open neither, and we iterate until infinity. As you could pass exceptions, for example Maybe we could detect if there are exceptions in the future and else, stop iterating after a week, then return |
The patch 2.3.1 introduces a iteration limit (8 days if there is no exceptions, 366 days else) and this limit can be customized with I close this issue as for me there are 2 different and not related subjects here. I consider the infinite loop as fixed. About the fact you expect the same result using If you still think, we should handle it differently or if you find inconsistencies in outputs, please open an other issue with what you expect and why, and maybe a real use-case for it because exemples of ever closed/ever open would not make too much sense according to the purpose of this library |
Hi Kyle, thanks for the detailed feedback. I understand your reasoning with the 24:00 vs 23:59 - I'll modify my code to work with that. I'm probably using this outside of your intended use-case as I'm using it to process alert schedules for an event system, so "always open" or 24x7x365 is one of the possible schedules that would probably not be usual for a business! Thanks for the 2.3.1 patch, much appreciated! |
I'm experiencing some strange problems with 2.3.0 when adding an hour range of ['00:00-24:00'] on a day.
Problem 1: When using nextOpen() the result will show the next week instead of the next day
Problem 2: When creating the object with an array instead of static statement, there is an infinite loop somewhere which causes a hang.
This seems to be quite similar to issue
#44 - Bug with next open when opening times are set to 00:00
, except that it affects the 24:00.Here is some example code:
The result of this is an incorrect value on the first var_dump, and a hang on the second:
Changing the "00:00" to "00:01" has no effect, but changing "24:00" to "23;59" resolves the issue with all three of the var_dump() statements returning the correct value of "2019-06-07 00:00:00".
The text was updated successfully, but these errors were encountered: