mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-03 14:17:06 +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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user