[wp-trac] [WordPress Trac] #41782: Using date_query with 'before' in WP_Query returns wrong timezone

WordPress Trac noreply at wordpress.org
Sat Sep 2 20:30:35 UTC 2017


#41782: Using date_query with 'before' in WP_Query returns wrong timezone
--------------------------+------------------------------
 Reporter:  Biranit       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Date/Time     |     Version:  4.8.1
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by birgire):

 If the {{{$datetime}}} string has the format  'Y', 'Y-m', 'Y-m-d' or
 'Y-m-d H:i' then it will skip:


 {{{
 gmdate( 'Y-m-d H:i:s', strtotime( $datetime, $now ) )
 }}}

 So '2017-01-01 10:00' should skip it too and get the seconds part from the

 {{{
 $datetime['second'] = ( $default_to_max ) ? 59 : 0;
 }}}

 But on the other hand '2017-01-01 10:00:00' does not skip it.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41782#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list