Support » Plugin: Woocommerce Open Close - Best Business Schedules Manager » The plugin does not respect time zones

  • Resolved lukoie

    (@lukoie)


    When I put the timezone in my WP settings, the time is wrong while the plugin is active.
    For example, I’m in UTC+2 now, and the time is 12:13am, and it shows the correct time in WP. But when i install the plugin, the time switches to 2:13am.
    SO if I set up the opening time for the shop at 9am in the plugin it won’t open the shop until 11am.

Viewing 6 replies - 1 through 6 (of 6 total)
  • I’ve commented the line #45 in the includes/classes/class-functions.php and the time stamp went back to normal.
    There was the code line date_default_timezone_set( $this->get_timezone_string() ); for some reason. Mate, it just says to get my current time zone and treat it as the UTC base. Why would you do that?

    Moderator Steve Stern

    (@sterndata)

    Support Team Volunteer

    (moved from reviews to support)

    In the previous version of the plugin(I like the backend of it) do the same in the
    /includes/functions.php file, line #67

    Plugin Author Jaed Mosharraf

    (@jaedm97)

    Hi (@lukoie),

    Thanks a lot for your comments about the timezone idea. I will definitely try this and push an update.

    Thank you again.

    Well, actually there’s another problem regading the same issue.
    If you just comment the timezone redefining, you will get an issue in the plugin itself.
    So the time on the WP will be correct, but the time for the plugin will be altered.
    For example, the time is 10:30am right now. The plugin is activated and that line is commented/deleted. The time on the WP config page will be correct, BUT on the plugin’s page it will be 8:30am.
    Even though you have a plain “php echo date( ‘h:i A T’ );” it get the wrong time.
    If you copy this line into separate php file and place it in the site’s root and open this file in the browser, you will get the right time (10:30).
    This means you’re treatin my timezone(well, actually my server’s timezone) as a UTC base.
    Need to mention as well that I use a city name as a timezone definition(it respects the summer time shifts correctly).

    ok, add this code to the line #315 in the “/includes/classes/class-functions.php” file:

    	function get_current_time(){
    		return date( 'h:i A T' );
    	}

    and it will work as a charm
    PS you need to call this function as a global in the class, that’s why it didn’t work

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘The plugin does not respect time zones’ is closed to new replies.