Closed jbgriesner closed 5 years ago
Thank you for your feedback!
It's fixed by the commit 20e1bad, and I just sent the update to PyPi. You can update your version to 1.0.0b3
. ;)
Thanks for your fast answer!
However your fix seems not perfect yet: indeed if you add to your test different months starting from the "next" year it fails:
>>> oh = OHParser("Oct-Mar 07:30-19:30; Apr-Sep 07:00-21:00")
>>> oh.is_open(datetime.datetime(2019, 1, 1, 12, 30)) # 1st Jan: it should be open...
False
>>> oh.is_open(datetime.datetime(2019, 2, 1, 12, 30)) # 1st Feb: it should be open...
False
>>> oh.is_open(datetime.datetime(2019, 3, 1, 12, 30)) # 1st March: it should be open...
False
This is due to the 52 weeks shift of the current year, which makes the "query date" outside of the opening hours limits.
Well, you're right. However, I don't see how to fix this properly (sorry)... Do you have any suggestion?
Please find my suggestion in PR https://github.com/rezemika/humanized_opening_hours/pull/27
I think it should fix these tricky cases
The opening hours of this place are:
It means that the 30th of november at 14h30 it should be open. However:
Now if I add the year as your grammar allows it, then it works as expected:
The problem appears when the MonthDayRange spans between two different years without the explicit information in the
monthday_date_month
.Do you have a solution to this problem ?
Thanks!