[wp-trac] [WordPress Trac] #25834: WP_Date_Query not allowed values possible

WordPress Trac noreply at wordpress.org
Tue Nov 5 12:48:42 UTC 2013


#25834: WP_Date_Query not allowed values possible
--------------------------+------------------------------
 Reporter:  ChriCo        |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Query         |     Version:  3.7
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------

Comment (by ChriCo):

 It is also possible to enter negativ values:


 {{{
 $date_query = new WP_Date_Query( array(
   'week'  => -1,
   'month'  => -1,
   'hour'  => -1,
   'minute' => -1,
   'second'  => -1,
   'dayofyear' => -1,
   'dayofweek' => -1
 ));
 echo $date_query->get_sql();
 /*
 AND (
  ( MONTH( post_date ) = -1
  AND WEEK( post_date, 1 ) = -1
  AND DAYOFYEAR( post_date ) = -1
  AND DAYOFWEEK( post_date ) = -1
  AND DATE_FORMAT( post_date, '%H.%i%s' ) = -1.000000 )
 )
 */
 }}}

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25834#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list