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!

Comments

sbubaron created an issue. See original summary.

johnv’s picture

Please check dev version. It should be solved.

sarav.din33’s picture

I have tried the development version, but still i have this issue.

sarav.din33’s picture

StatusFileSize
new25.29 KB

I have changed my Hours format from 24hrs (9:00am) to 12hrs (9:00am), in field settings. Its works for midnight value.

dpovshed’s picture

Version: 7.x-1.4 » 7.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new23.35 KB
new772 bytes

@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!

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Makes sense

taran2l’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new1.72 KB
new515 bytes

Patch #5 doesn't allow to save 00:00 - 00:00 (i.e. open 24h). New patch attached. Please review.

uberhacker’s picture

The 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 hours validation works correctly.

uberhacker’s picture

StatusFileSize
new1.83 KB
uberhacker’s picture

Attached is a new and improved version that validates times that span into the next day.

destinationsound’s picture

Any news when these fixes will go to the stable release? i don't want to use the dev on my production site.

  • johnv committed 92a4e60 on 7.x-1.x authored by uberhacker
    Issue #2553501 by uberhacker, Taran2L, dpovshed, sarav.din33: Midnight...
johnv’s picture

Status: Needs review » Fixed

I didn't really understand the implications of #10, so I stick with #9.

Thanks all

johnv’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev
Status: Fixed » Patch (to be ported)
uberhacker’s picture

StatusFileSize
new1.7 KB

@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.

johnv’s picture

Component: Code » Code - widget
johnv’s picture

Title: Midnight Values » Midnight Values (D7)
Version: 8.x-1.x-dev » 7.x-1.x-dev
Status: Patch (to be ported) » Needs review
johnv’s picture

@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.

johnv’s picture

Title: Midnight Values (D7) » Midnight Values for Start hours OR End hours (D7)
Version: 7.x-1.x-dev » 7.x-1.5
Status: Needs review » Fixed

Closing 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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

uberhacker’s picture

@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.