mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-01 03:04:34 +00:00
Date/Time: Fix usage of $gmt parameter in date_i18n() and clarify its behavior.
The docs for `date_i18n()` and its filter now correctly state that the `$gmt` parameter is only taken into account if no timestamp is provided. Furthermore, a bug with that parameter is fixed, as it is now ensured that the timezone used with it is `UTC`. Props Rarst. Fixes #38771. git-svn-id: https://develop.svn.wordpress.org/trunk@43389 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -14,7 +14,7 @@ class Tests_Date_I18n extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
public function test_date_should_be_in_gmt() {
|
||||
$this->assertEquals( strtotime( date( 'Y-m-d H:i:s' ) ), strtotime( date_i18n( 'Y-m-d H:i:s', false, true ) ), 'The dates should be equal', 2 );
|
||||
$this->assertEquals( strtotime( date( DATE_RFC3339 ) ), strtotime( date_i18n( DATE_RFC3339, false, true ) ), 'The dates should be equal', 2 );
|
||||
}
|
||||
|
||||
public function test_custom_timestamp_ignores_gmt_setting() {
|
||||
@@ -30,7 +30,7 @@ class Tests_Date_I18n extends WP_UnitTestCase {
|
||||
public function test_date_should_be_in_gmt_with_custom_timezone_setting() {
|
||||
update_option( 'timezone_string', 'America/Regina' );
|
||||
|
||||
$this->assertEquals( strtotime( date( 'Y-m-d H:i:s' ) ), strtotime( date_i18n( 'Y-m-d H:i:s', false, true ) ), 'The dates should be equal', 2 );
|
||||
$this->assertEquals( strtotime( date( DATE_RFC3339 ) ), strtotime( date_i18n( DATE_RFC3339, false, true ) ), 'The dates should be equal', 2 );
|
||||
}
|
||||
|
||||
public function test_date_should_be_in_gmt_with_custom_timezone_setting_and_timestamp() {
|
||||
|
||||
Reference in New Issue
Block a user