Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#34228 closed defect (bug) (fixed)

'WP_Date_Query' ignores hour parameter when hour = 0 and valid minute parameter

Reported by: jim912's profile jim912 Owned by: boonebgorges's profile boonebgorges
Milestone: 4.4 Priority: normal
Severity: normal Version: 4.4
Component: Query Keywords: has-patch
Focuses: Cc:

Description

when request like below query

?year=2015&monthnum=10&day=5&hour=0&minute=3

created sql is

 AND ( 
  ( YEAR( wp_posts.post_date ) = 2015 AND MONTH( wp_posts.post_date ) = 10 AND DAYOFMONTH( wp_posts.post_date ) = 5 AND DATE_FORMAT( wp_posts.post_date, '0.%i' ) = 0.030000 )
)

0 hour parameter ignored

Attachments (2)

34228.patch (345 bytes) - added by jim912 9 years ago.
34228.2.patch (347 bytes) - added by jim912 9 years ago.
reattached fixed file

Download all attachments as: .zip

Change History (6)

@jim912
9 years ago

@jim912
9 years ago

reattached fixed file

#1 @SergeyBiryukov
9 years ago

  • Summary changed from 'WP_Date_Query' igored hour parameter when hour = 0 and valid minute parameter to 'WP_Date_Query' ignores hour parameter when hour = 0 and valid minute parameter

#2 @swissspidy
9 years ago

  • Keywords has-patch added

#3 @boonebgorges
9 years ago

  • Milestone changed from Awaiting Review to 4.4
  • Owner set to boonebgorges
  • Status changed from new to assigned

Good find, and thanks for the patch!

#4 @boonebgorges
9 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 34989:

Ensure that WP_Date_Query accepts a value of 0 for 'hour'.

Props jim912.
Fixes #34228.

Note: See TracTickets for help on using tickets.