Changeset 43389
- Timestamp:
- 07/04/2018 11:42:59 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r43387 r43389 89 89 * @param int|bool $timestamp_with_offset Optional. A sum of Unix timestamp and timezone offset in seconds. 90 90 * Default false. 91 * @param bool $gmt Optional. Whether to use GMT timezone. Default false. 91 * @param bool $gmt Optional. Whether to use GMT timezone. Only applies if timestamp is 92 * not provided. Default false. 92 93 * 93 94 * @return string The date, translated if locale specifies it. … … 128 129 if ( preg_match( "/$timezone_formats_re/", $dateformatstring ) ) { 129 130 $timezone_string = get_option( 'timezone_string' ); 131 if ( false === $timestamp_with_offset && $gmt ) { 132 $timezone_string = 'UTC'; 133 } 130 134 if ( $timezone_string ) { 131 135 $timezone_object = timezone_open( $timezone_string ); … … 181 185 * @param string $req_format Format to display the date. 182 186 * @param int $i A sum of Unix timestamp and timezone offset in seconds. 183 * @param bool $gmt Whether to convert to GMT for time. Default false. 187 * @param bool $gmt Whether to use GMT timezone. Only applies if timestamp was 188 * not provided. Default false. 184 189 */ 185 190 $j = apply_filters( 'date_i18n', $j, $req_format, $i, $gmt ); -
trunk/tests/phpunit/tests/date/dateI18n.php
r43387 r43389 15 15 16 16 public function test_date_should_be_in_gmt() { 17 $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 );17 $this->assertEquals( strtotime( date( DATE_RFC3339 ) ), strtotime( date_i18n( DATE_RFC3339, false, true ) ), 'The dates should be equal', 2 ); 18 18 } 19 19 … … 31 31 update_option( 'timezone_string', 'America/Regina' ); 32 32 33 $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 );33 $this->assertEquals( strtotime( date( DATE_RFC3339 ) ), strtotime( date_i18n( DATE_RFC3339, false, true ) ), 'The dates should be equal', 2 ); 34 34 } 35 35
Note: See TracChangeset
for help on using the changeset viewer.