[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 19:02:00 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):

 What happens when you use an array of an array and skip the seconds:

 {{{
 'date_query' => array( array( 'before' => '2017-01-01 10:00' ) )
 }}}

 It's interesting to see that {{{$datetime}}} in
 {{{WP_Date_Query::build_mysql_datetime()}}}

 https://github.com/WordPress/WordPress/blob/bbb8d48086b7d10908f4fda673585ee122f2851d
 /wp-includes/date.php#L856

 is matched for 'Y', 'Y-m', 'Y-m-d', 'Y-m-d H:i' but not 'Y-m-d H:i:s'.

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


More information about the wp-trac mailing list