• Resolved kjc

    (@kevinyellowjacketca)


    Hi, I noticed that the next available time on our site is not accounting for GMT offset. I looked at the following code in DateTimePicker.php and think there is a bug:

    public function get_next_available_time( $opts ) {
    $tzoffset = get_option( ‘gmt_offset’ );
    $tzoffset = strpos(‘-‘, $tzoffset) ? ‘-‘ . $tzoffset : ‘+’ . $tzoffset;

    }

    From what I can tell the strpos line is unnecessary, since $tzoffset already has a minus sign (e.g. here in Edmonton time zone the result of the get_option call is -6).
    Also the order of the strpos parms are backwards (it is needle, haystack but should be the opposite). The time is correct if I comment out this line.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @kevinyellowjacketca
    Yes, that’s definitely a bug!
    Thank you for reporting.

    The correct code would be
    $tzoffset = strpos( $tzoffset, '-' ) === 0 ? $tzoffset : '+' . $tzoffset;

    I’ll include the fix in the next update. Thank you once again for reporting.

    Should be fixed in the latest update. Thank you for reporting. Cheers

    I believe that this may be a similar issue affecting EST (Toronto/America). Our next available time when selecting our time zone or UTC -4:00 is off by 4 hours approximately.

    Any idea what is happening. It is 11:17am and the next available time is displaying 3:30pm.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Bug in get_next_available_time’ is closed to new replies.