Simplify the weeks-per-year calculation WP_Date_Query::validate_date_values().

Props luciole135.
Fixes #30845.
Built from https://develop.svn.wordpress.org/trunk@33803


git-svn-id: http://core.svn.wordpress.org/trunk@33771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2015-08-29 01:47:21 +00:00
parent 50d4d4a956
commit f1d6acac56
2 changed files with 6 additions and 5 deletions

View File

@ -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.

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-33802';
$wp_version = '4.4-alpha-33803';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.