mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-09 07:04:34 +00:00
Introduced dayofweek_iso time param for WP_Date_Query.
The initial `dayofweek` param sets day 1 to Sunday. This is out of step with ISO standards, which calls Monday day 1. To maintain backward compatibility with the existing parameter, we introduce the new `dayofweek_iso` for the new, more compliant param. Props mboynes. Fixes #28063. git-svn-id: https://develop.svn.wordpress.org/trunk@30142 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -635,6 +635,24 @@ class Tests_Query_DateQuery extends WP_UnitTestCase {
|
||||
$this->assertEquals( array( $p1 ), wp_list_pluck( $posts, 'ID' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 28063
|
||||
*/
|
||||
public function test_date_query_dayofweek_iso() {
|
||||
$p1 = $this->factory->post->create( array( 'post_date' => '2014-10-31 10:42:29', ) );
|
||||
$p2 = $this->factory->post->create( array( 'post_date' => '2014-10-30 10:42:29', ) );
|
||||
|
||||
$posts = $this->_get_query_result( array(
|
||||
'date_query' => array(
|
||||
array(
|
||||
'dayofweek_iso' => 5,
|
||||
),
|
||||
),
|
||||
) );
|
||||
|
||||
$this->assertEquals( array( $p1 ), wp_list_pluck( $posts, 'ID' ) );
|
||||
}
|
||||
|
||||
public function test_date_query_hour() {
|
||||
$p1 = $this->factory->post->create( array( 'post_date' => '2014-10-21 13:42:29', ) );
|
||||
$p2 = $this->factory->post->create( array( 'post_date' => '2014-10-21 12:42:29', ) );
|
||||
|
||||
Reference in New Issue
Block a user