Comments (4)
First of all the result "2019-06-10 00:00:00.000000"
is correct, because "2019-06-06 19:02:00"
is Thursday and so open, it does not close until Saturday 00:00 (since it's continuously open from Monday to Friday included), and re-open on Monday 00:00 (the next open "2019-06-10 00:00:00.000000"
). Why would you expect an other result?
Then 23:59
is different from 24:00
because it means it's closed 1 minute each night.
I will fix the infinite loop bug. But unless you can explain why it's incorrect, the outputs will not change.
from opening-hours.
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 '2035-05-12' => ['00:00-02:00']
it justifies we continue to search for the possible next open.
Maybe we could detect if there are exceptions in the future and else, stop iterating after a week, then return null
or throwing an exception.
from opening-hours.
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 ->setDayLimit()
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 "24:00"
or "23;59"
I can't be agree, opening-hours is minute-precise so 24:00
= 00:00
on next day, while 23:59
is 1 minute before.
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
from opening-hours.
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!
from opening-hours.
Related Issues (20)
- Github URL update HOT 2
- [Question/Feature Request] How to get all days of the current week including days resulting from exceptions? HOT 3
- [Bug] nextOpen calculates the wrong date for a regular day with exceptions HOT 3
- timezone is set on passed object when getting hours for a specific date HOT 2
- Free time slots during the day ? HOT 1
- nextOpen not respecting timezone HOT 2
- Timezone not working in currentOpenRange HOT 2
- I want to add schedule for specific date HOT 1
- Locale? HOT 1
- GitHub repository link not working HOT 2
- Support for holidays HOT 5
- Overflow support does not seem to work for createAndMergeOverlappingRanges HOT 2
- diffInOpenMinutes() does not work if only one day is configured as open HOT 6
- Date period in exceptions or start and end date for a set of days of the week in regular time HOT 4
- Exceptions with date ranges HOT 5
- [Feature request] createFromStructuredData method
- How to destroy OpeningHours object or update it ? HOT 1
- How to create an exception using datetime with seconds HOT 2
- Adding seconds precision to exceptions HOT 2
- Output time zone taken into account in all methods? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opening-hours.