IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 176 | 176 | */ |
| 177 | 177 | if ( 'U' === $format ) { |
| 178 | 178 | $date = $timestamp; |
| 179 | | } elseif ( $gmt && ! $timestamp_with_offset ) { // Current time in UTC. |
| | 179 | } elseif ( $gmt && ( false === $timestamp_with_offset ) ) { // Current time in UTC. |
| 180 | 180 | $date = wp_date( $format, null, new DateTimeZone( 'UTC' ) ); |
| 181 | | } elseif ( ! $timestamp_with_offset ) { // Current time in site's timezone. |
| | 181 | } elseif ( false === $timestamp_with_offset ) { // Current time in site's timezone. |
| 182 | 182 | $date = wp_date( $format ); |
| 183 | 183 | } else { |
| 184 | 184 | /* |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 19 | 19 | $this->assertEquals( $wp_timestamp, date_i18n( 'U', 'invalid' ), '', 5 ); |
| 20 | 20 | } |
| 21 | 21 | |
| | 22 | public function test_should_handle_zero_timestamp() { |
| | 23 | $timezone = 'Europe/Kiev'; |
| | 24 | update_option( 'timezone_string', $timezone ); |
| | 25 | |
| | 26 | $datetime = DateTimeImmutable::createFromFormat( |
| | 27 | 'Y-m-d H:i:s', |
| | 28 | '1970-01-01 00:00:00', |
| | 29 | new DateTimeZone( $timezone ) |
| | 30 | ); |
| | 31 | $rfc3339 = $datetime->format( DATE_RFC3339 ); |
| | 32 | |
| | 33 | $this->assertEquals( 0, date_i18n( 'U', 0 ) ); |
| | 34 | $this->assertEquals( $rfc3339, date_i18n( DATE_RFC3339, 0 ) ); |
| | 35 | } |
| | 36 | |
| 22 | 37 | public function test_should_format_date() { |
| 23 | 38 | $this->assertEquals( strtotime( gmdate( 'Y-m-d H:i:s' ) ), strtotime( date_i18n( 'Y-m-d H:i:s' ) ), 'The dates should be equal', 2 ); |
| 24 | 39 | } |