Working hours not allowing me to set 12am-12am

I am trying to set up working hours for this site as following:

Sun-Mon (12am-12am) - Break Time (2am-8am)

The system is only allowing me to at the very most set it to 12am-11:45pm which leave that slot busy for those wanting to book a one hour session at 11am, thus rendering that slot useless and unbookable. Is there any way to make sure we can flush the working hours from 12am-12am? This is mission critical for this site.

Thank you!
Eric Gomez
RedLoungeStudio.com Webmaster

  • PC
    • WPMU DEV Initiate

    Hello there Eric,

    Thanks for posting on the forums.

    Sorry to hear about the issues you are facing. I just tested on my lab site and it allows me to choose the hours correctly.

    Let me have a closer look at your issue. You can enable support access via :

    WordPress Dashboard >> WPMU DEV Dashboard >> Support >> Staff Access >> Grant Access.

    If you have not installed WPMU DEV Dashboard plugin yet, kindly do that here : https://premium.wpmudev.org/project/wpmu-dev-dashboard/ and then allow access as per the above process.

    Please let me know once done.

    Cheers, PC

  • Mrinal
    • Site Builder, Child of Zeus

    Hey Eric,

    Sorry for the delayed response.

    When I tried to access your site, it shows me Sorry, this is an invalid access token. You must ask the user to grant access.

    Please allow access again to your site, Thanks!

  • PC
    • WPMU DEV Initiate

    Hello there Eric,

    Thanks for posting back.

    I had a closer look, matched the settings with those of mine and found that the issue is somewhere on your server.

    I changed the timezone from New York to UTC and then found that the last entry in the Working hours for "End" field appears as the current server time.

    I have sent this to the attention of our second level support to see what might be wrong as I can not find anything in the first place.

    One of them should be around soon.

    Cheers, PC

  • Jose
    • Bruno Diaz

    Hey there @Eric,

    Sorry for the delay on this.
    I'm struggling around your issue, but still can't reproduce it.

    As you can see in the attached image, it works as expected in my installation. -please confirm if that is what you are trying to achieve-.

    I would need you to provide the following information in the contact form in order to move forward:

    - In the subject field add "Attn: Jose”
    - Link back to this thread
    - Include admin/network access
    - Include FTP
    - Include any relevant URLS for your site, custom code, or plugins that might be causing issues.
    - Also, please grant support access again.

    On the contact form, select "I have a different question", this ensures it comes through and gets assigned to me.

    https://premium.wpmudev.org/contact/

    Thanks!
    JJ

  • Jose
    • Bruno Diaz

    Hi again @Eric,

    I'm happy to say that I found and fixed the error. :slight_smile:

    As @PC mentioned, the option 24:00 in the working hours form was replaced by the server time. After a while debugging I found that the method strtotime() does not take as valid argument the value "24:00:00" prior to PHP version 5.3. Wordpress method date_i18n() returns server current time when the time is not provided.

    That said, I added a workaround to the code, but my advice would be to update your PHP version to a newer one, because this issue will break some other plugin or theme sooner or later.

    You can see the schedule working as you want for the provider "Other Engineer".

    I'll be waiting for your feedback! :slight_smile:

    Take care,
    JJ

    For the records, I added on line of code to the function "secs2hours" in appointments.php line 1082:
    $secs = 86400 == $secs ? 0 : $secs;

    So the final function looks like this:

    function secs2hours( $secs, $forced_format=false ) {
            $secs = 86400 == $secs ? 0 : $secs;
    		$min = (int)($secs / 60);
    		$hours = "00";
    		if ( $min < 60 )
    			$hours_min = $hours . ":" . $min;
    		else {
    			$hours = (int)($min / 60);
    			if ( $hours < 10 )
    				$hours = "0" . $hours;
    			$mins = $min - $hours * 60;
    			if ( $mins < 10 )
    				$mins = "0" . $mins;
    			$hours_min = $hours . ":" . $mins;
    		}
    
    		if (!empty($forced_format)){
                $hours_min = date_i18n($forced_format, strtotime($hours_min . ":00"));
            }
    		else if ($this->time_format){
                $hours_min = date_i18n($this->time_format, strtotime($hours_min . ":00")); // @TODO: TEST THIS THOROUGHLY!!!!
            }
    		return $hours_min;
    	}
  • Jose
    • Bruno Diaz

    @Eric,

    Just in case, if you stick with PHP 5.2.17 for any reason, remember that your plugin is now customized, so the changes will be rolled back if you update the plugin.

    If you are moving to PHP +5.3 you are good to go and you can update the plugin without issues.

    Please let me know if everything goes as expected.

    Cheers!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.