mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-29 07:37:44 +02:00
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:
parent
50d4d4a956
commit
f1d6acac56
@ -355,10 +355,11 @@ class WP_Date_Query {
|
|||||||
|
|
||||||
// Weeks per year.
|
// Weeks per year.
|
||||||
if ( isset( $_year ) ) {
|
if ( isset( $_year ) ) {
|
||||||
// If we have a specific year, use it to calculate number of weeks.
|
/*
|
||||||
$date = new DateTime();
|
* If we have a specific year, use it to calculate number of weeks.
|
||||||
$date->setISODate( $_year, 53 );
|
* Note: the number of weeks in a year is the date in which Dec 28 appears.
|
||||||
$week_count = $date->format( "W" ) === "53" ? 53 : 52;
|
*/
|
||||||
|
$week_count = date( 'W', mktime( 0, 0, 0, 12, 28, $_year ) );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Otherwise set the week-count to a maximum of 53.
|
// Otherwise set the week-count to a maximum of 53.
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user