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:
Boone Gorges
2014-11-01 03:23:15 +00:00
parent d6b7b7aa41
commit 7c64b3b3dd
3 changed files with 50 additions and 2 deletions
+18
View File
@@ -924,6 +924,24 @@ class Tests_WP_Date_Query extends WP_UnitTestCase {
}
}
/**
* @ticket 28063
* @expectedIncorrectUsage WP_Date_Query
*/
public function test_validate_date_values_day_of_week_iso() {
// Valid values.
$days_of_week = range( 1, 7 );
foreach ( $days_of_week as $day_of_week ) {
$this->assertTrue( $this->q->validate_date_values( array( 'dayofweek_iso' => $day_of_week ) ) );
}
// Invalid values.
$days_of_week = array( -1, 0, 8 );
foreach ( $days_of_week as $day_of_week ) {
$this->assertFalse( $this->q->validate_date_values( array( 'dayofweek_iso' => $day_of_week ) ) );
}
}
/**
* @ticket 25834
* @expectedIncorrectUsage WP_Date_Query