Make WordPress Core


Ignore:
Timestamp:
11/01/2014 03:23:15 AM (9 years ago)
Author:
boonebgorges
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/query/dateQuery.php

    r29993 r30142  
    629629                array(
    630630                    'dayofweek' => 3,
     631                ),
     632            ),
     633        ) );
     634
     635        $this->assertEquals( array( $p1 ), wp_list_pluck( $posts, 'ID' ) );
     636    }
     637
     638    /**
     639     * @ticket 28063
     640     */
     641    public function test_date_query_dayofweek_iso() {
     642        $p1 = $this->factory->post->create( array( 'post_date' => '2014-10-31 10:42:29', ) );
     643        $p2 = $this->factory->post->create( array( 'post_date' => '2014-10-30 10:42:29', ) );
     644
     645        $posts = $this->_get_query_result( array(
     646            'date_query' => array(
     647                array(
     648                    'dayofweek_iso' => 5,
    631649                ),
    632650            ),
Note: See TracChangeset for help on using the changeset viewer.