Make WordPress Core


Ignore:
Timestamp:
11/01/2014 03:23:15 AM (10 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/date/query.php

    r29933 r30142  
    926926
    927927    /**
     928     * @ticket 28063
     929     * @expectedIncorrectUsage WP_Date_Query
     930     */
     931    public function test_validate_date_values_day_of_week_iso() {
     932        // Valid values.
     933        $days_of_week = range( 1, 7 );
     934        foreach ( $days_of_week as $day_of_week ) {
     935            $this->assertTrue( $this->q->validate_date_values( array( 'dayofweek_iso' => $day_of_week ) ) );
     936        }
     937
     938        // Invalid values.
     939        $days_of_week = array( -1, 0, 8 );
     940        foreach ( $days_of_week as $day_of_week ) {
     941            $this->assertFalse( $this->q->validate_date_values( array( 'dayofweek_iso' => $day_of_week ) ) );
     942        }
     943    }
     944
     945    /**
    928946     * @ticket 25834
    929947     * @expectedIncorrectUsage WP_Date_Query
Note: See TracChangeset for help on using the changeset viewer.