X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/dc1231b7312fbdca99e9e887cc2bb35a28f85cdc..refs/tags/wordpress-4.4:/wp-includes/date.php diff --git a/wp-includes/date.php b/wp-includes/date.php index 2e903a25..e10ef4f8 100644 --- a/wp-includes/date.php +++ b/wp-includes/date.php @@ -355,10 +355,11 @@ class WP_Date_Query { // Weeks per year. if ( isset( $_year ) ) { - // If we have a specific year, use it to calculate number of weeks. - $date = new DateTime(); - $date->setISODate( $_year, 53 ); - $week_count = $date->format( "W" ) === "53" ? 53 : 52; + /* + * If we have a specific year, use it to calculate number of weeks. + * Note: the number of weeks in a year is the date in which Dec 28 appears. + */ + $week_count = date( 'W', mktime( 0, 0, 0, 12, 28, $_year ) ); } else { // Otherwise set the week-count to a maximum of 53. @@ -991,7 +992,7 @@ class WP_Date_Query { $format = $time = ''; // Hour - if ( $hour ) { + if ( null !== $hour ) { $format .= '%H.'; $time .= sprintf( '%02d', $hour ) . '.'; } else {