First off, thanks for providing this module, it is working well for us, but recently we changed our hours for some locations to need to close at midnight, specifically we are trying to set the hours to be from Sunday 12:00pm - 12:00am
This seems to trigger an error message "Both Opening hours and Closing hours must be set." It seems that the check for midnight, returns 0 (false) line 177 office_hours.elements.inc
It should be noted that I turned validation OFF, so I'm not sure why its trying to validate anyway.
I commented out that check to get around the error, but now the printed text shows the site as Closed, before I start hacking away I wanted to see if this is a known issue or if there is a better approach I should be taking.
Thanks!
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | office_hours-midnight_values-15.patch | 1.7 KB | uberhacker |
| #10 | office_hours-midnight_values-2553501-8.patch | 2.16 KB | uberhacker |
| #9 | office_hours-validation-fix-11517943.patch | 1.83 KB | uberhacker |
| #7 | interdiff-2553501-5-7.txt | 515 bytes | taran2l |
| #7 | office_hours-midnight_values-2553501-7.patch | 1.72 KB | taran2l |
Comments
Comment #2
johnvPlease check dev version. It should be solved.
Comment #3
sarav.din33 commentedI have tried the development version, but still i have this issue.
Comment #4
sarav.din33 commentedI have changed my Hours format from 24hrs (9:00am) to 12hrs (9:00am), in field settings. Its works for midnight value.
Comment #5
dpovshed commented@johnv, thank you for your recent addition, now it is possible to select closing time at midnight (in dev version only). However, validation for that case needs minor fix as well.
Please see the picture with sample error and also patch, which I am gonna use on my project.
Thanks for such useful module!
Comment #6
andypostMakes sense
Comment #7
taran2lPatch #5 doesn't allow to save 00:00 - 00:00 (i.e. open 24h). New patch attached. Please review.
Comment #8
uberhacker commentedThe midnight validation was still not working for me even after applying the latest patch. I have attached a new patch which makes sure the
Closing hours are earlier than Opening hoursvalidation works correctly.Comment #9
uberhacker commentedComment #10
uberhacker commentedAttached is a new and improved version that validates times that span into the next day.
Comment #11
destinationsound commentedAny news when these fixes will go to the stable release? i don't want to use the dev on my production site.
Comment #13
johnvI didn't really understand the implications of #10, so I stick with #9.
Thanks all
Comment #14
johnvComment #15
uberhacker commented@johnv: The patch in #10 was necessary in my case, since the radio station site I have installed this module regularly has hours such as 10 pm - 2 am. In these cases, you still want the hours to validate, right? Attached is a patch applied against the latest dev version.
Comment #16
johnvComment #17
johnvSetting this issue back to D7. For D8, some other issues are already available:
- #2768577: Setting the hours to zero triggers primitive type validation error
- #2764193: Setting opening OR closing hours to Midnight
Comment #18
johnv@uberhacker, IMO your patch is not necessary. If your hours extend until into the night, you should turn off the 'validation', because in that case, any combination of field will be acceptable.
Comment #19
johnvClosing this issue.
Only the case where BOTH opening hours and closing hours are 0000 (00:00 until 24:00) is not covered, yet.
Will look into that only if someone asks this. Focus for new functionilty is on D8.
Comment #21
uberhacker commented@johnv: If you turn off validation as a solution, why even provide it in the first place? Please reconsider my use case before saying it is unnecessary.