<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[45882] trunk: Date/Time: Rewrite and simplify `date_i18n()` using `wp_timezone()` to address multiple issues with certain date formats and timezones, while preserving some extra handling for legacy use cases.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/45882">45882</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/45882","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2019-08-23 00:56:21 +0000 (Fri, 23 Aug 2019)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Date/Time: Rewrite and simplify `date_i18n()` using `wp_timezone()` to address multiple issues with certain date formats and timezones, while preserving some extra handling for legacy use cases.
Improve unit test coverage.
Props Rarst, remcotolsma, raubvogel.
Fixes <a href="https://core.trac.wordpress.org/ticket/25768">#25768</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesfunctionsphp">trunk/src/wp-includes/functions.php</a></li>
<li><a href="#trunktestsphpunittestsdatedateI18nphp">trunk/tests/phpunit/tests/date/dateI18n.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesfunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/functions.php 2019-08-22 19:07:57 UTC (rev 45881)
+++ trunk/src/wp-includes/functions.php 2019-08-23 00:56:21 UTC (rev 45882)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -129,6 +129,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * take over the format for the date. If it isn't, then the date format string
</span><span class="cx" style="display: block; padding: 0 10px"> * will be used instead.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Note that due to the way WP typically generates a sum of timestamp and offset
+ * with `strtotime()`, it implies offset added at a _current_ time, not at the time
+ * the timestamp represents. Storing such timestamps or calculating them differently
+ * will lead to invalid output.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @since 0.71
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global WP_Locale $wp_locale WordPress date and time locale object.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -143,6 +148,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function date_i18n( $dateformatstring, $timestamp_with_offset = false, $gmt = false ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_locale;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> $i = $timestamp_with_offset;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_numeric( $i ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -154,79 +160,73 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * See https://core.trac.wordpress.org/ticket/9396
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> $req_format = $dateformatstring;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $new_format = '';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $dateformatstring = preg_replace( '/(?<!\\\\)c/', DATE_W3C, $dateformatstring );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // We need to unpack shorthand `r` format because it has parts that might be localized.
</ins><span class="cx" style="display: block; padding: 0 10px"> $dateformatstring = preg_replace( '/(?<!\\\\)r/', DATE_RFC2822, $dateformatstring );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ( ! empty( $wp_locale->month ) ) && ( ! empty( $wp_locale->weekday ) ) ) {
- $datemonth = $wp_locale->get_month( gmdate( 'm', $i ) );
- $datemonth_abbrev = $wp_locale->get_month_abbrev( $datemonth );
- $dateweekday = $wp_locale->get_weekday( gmdate( 'w', $i ) );
- $dateweekday_abbrev = $wp_locale->get_weekday_abbrev( $dateweekday );
- $datemeridiem = $wp_locale->get_meridiem( gmdate( 'a', $i ) );
- $datemeridiem_capital = $wp_locale->get_meridiem( gmdate( 'A', $i ) );
- $dateformatstring = ' ' . $dateformatstring;
- $dateformatstring = preg_replace( '/([^\\\])D/', "\\1" . backslashit( $dateweekday_abbrev ), $dateformatstring );
- $dateformatstring = preg_replace( '/([^\\\])F/', "\\1" . backslashit( $datemonth ), $dateformatstring );
- $dateformatstring = preg_replace( '/([^\\\])l/', "\\1" . backslashit( $dateweekday ), $dateformatstring );
- $dateformatstring = preg_replace( '/([^\\\])M/', "\\1" . backslashit( $datemonth_abbrev ), $dateformatstring );
- $dateformatstring = preg_replace( '/([^\\\])a/', "\\1" . backslashit( $datemeridiem ), $dateformatstring );
- $dateformatstring = preg_replace( '/([^\\\])A/', "\\1" . backslashit( $datemeridiem_capital ), $dateformatstring );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /*
+ * Timestamp with offset is typically produced by a UTC `strtotime()` call on an input without timezone.
+ * This is the best attempt to reverse that operation into a local time to use.
+ */
+ $local_time = gmdate( 'Y-m-d H:i:s', $i );
+ $gmt_mode = $gmt && ( false === $timestamp_with_offset );
+ $timezone = $gmt_mode ? new DateTimeZone( 'UTC' ) : wp_timezone();
+ $datetime = date_create( $local_time, $timezone );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) - 1 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /*
+ * This is a legacy implementation quirk that the returned timestamp is also with offset.
+ * Ideally this function should never be used to produce a timestamp.
+ */
+ $timestamp_mode = ( 'U' === $dateformatstring );
+
+ if ( $timestamp_mode ) {
+ $new_format = $i;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $timezone_formats = array( 'P', 'I', 'O', 'T', 'Z', 'e' );
- $timezone_formats_re = implode( '|', $timezone_formats );
- if ( preg_match( "/$timezone_formats_re/", $dateformatstring ) ) {
- $timezone_string = get_option( 'timezone_string' );
- if ( false === $timestamp_with_offset && $gmt ) {
- $timezone_string = 'UTC';
- }
- if ( $timezone_string ) {
- $timezone_object = timezone_open( $timezone_string );
- $date_object = date_create( null, $timezone_object );
- foreach ( $timezone_formats as $timezone_format ) {
- if ( false !== strpos( $dateformatstring, $timezone_format ) ) {
- $formatted = date_format( $date_object, $timezone_format );
- $dateformatstring = ' ' . $dateformatstring;
- $dateformatstring = preg_replace( "/([^\\\])$timezone_format/", "\\1" . backslashit( $formatted ), $dateformatstring );
- $dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) - 1 );
- }
- }
- } else {
- $offset = get_option( 'gmt_offset' );
- foreach ( $timezone_formats as $timezone_format ) {
- if ( 'I' === $timezone_format ) {
- continue;
- }
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( false !== strpos( $dateformatstring, $timezone_format ) ) {
- if ( 'Z' === $timezone_format ) {
- $formatted = (string) ( $offset * HOUR_IN_SECONDS );
- } else {
- $prefix = '';
- $hours = (int) $offset;
- $separator = '';
- $minutes = abs( ( $offset - $hours ) * 60 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! $timestamp_mode && ! empty( $wp_locale->month ) && ! empty( $wp_locale->weekday ) ) {
+ $month = $wp_locale->get_month( $datetime->format( 'm' ) );
+ $weekday = $wp_locale->get_weekday( $datetime->format( 'w' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 'T' === $timezone_format ) {
- $prefix = 'GMT';
- } elseif ( 'e' === $timezone_format || 'P' === $timezone_format ) {
- $separator = ':';
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $format_length = strlen( $dateformatstring );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $formatted = sprintf( '%s%+03d%s%02d', $prefix, $hours, $separator, $minutes );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for ( $i = 0; $i < $format_length; $i ++ ) {
+ switch ( $dateformatstring[ $i ] ) {
+ case 'D':
+ $new_format .= backslashit( $wp_locale->get_weekday_abbrev( $weekday ) );
+ break;
+ case 'F':
+ $new_format .= backslashit( $month );
+ break;
+ case 'l':
+ $new_format .= backslashit( $weekday );
+ break;
+ case 'M':
+ $new_format .= backslashit( $wp_locale->get_month_abbrev( $month ) );
+ break;
+ case 'a':
+ $new_format .= backslashit( $wp_locale->get_meridiem( $datetime->format( 'a' ) ) );
+ break;
+ case 'A':
+ $new_format .= backslashit( $wp_locale->get_meridiem( $datetime->format( 'A' ) ) );
+ break;
+ case '\\':
+ $new_format .= $dateformatstring[ $i ];
+
+ // If character follows a slash, we add it without translating.
+ if ( $i < $format_length ) {
+ $new_format .= $dateformatstring[ ++$i ];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- $dateformatstring = ' ' . $dateformatstring;
- $dateformatstring = preg_replace( "/([^\\\])$timezone_format/", "\\1" . backslashit( $formatted ), $dateformatstring );
- $dateformatstring = substr( $dateformatstring, 1 );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ break;
+ default:
+ $new_format .= $dateformatstring[ $i ];
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $j = gmdate( $dateformatstring, $i );
</del><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $j = $datetime->format( $new_format );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Filters the date formatted based on the locale.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -239,6 +239,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * not provided. Default false.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> $j = apply_filters( 'date_i18n', $j, $req_format, $i, $gmt );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> return $j;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1556,6 +1557,40 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Display the robots.txt file content.
+ *
+ * The echo content should be with usage of the permalinks or for creating the
+ * robots.txt file.
+ *
+ * @since 5.3.0
+ */
+function do_favicon() {
+ /**
+ * Fires when serving the favicon.ico file.
+ *
+ * @since 5.3.0
+ */
+ do_action( 'do_faviconico' );
+
+ wp_safe_redirect( esc_url( get_site_icon_url( 32, admin_url( 'images/w-logo-blue.png' ) ) ) );
+
+}
+
+/**
+ * Don't load all of WordPress when handling a favicon.ico request.
+ *
+ * Instead, send the headers for a zero-length favicon and bail.
+ *
+ * @since 3.0.0
+ */
+function wp_favicon_request() {
+ if ( '/favicon.ico' == $_SERVER['REQUEST_URI'] ) {
+ header( 'Content-Type: image/vnd.microsoft.icon' );
+ exit;
+ }
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Determines whether WordPress is already installed.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * The cache will be checked first. If you have a cache plugin, which saves
</span></span></pre></div>
<a id="trunktestsphpunittestsdatedateI18nphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/date/dateI18n.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/date/dateI18n.php 2019-08-22 19:07:57 UTC (rev 45881)
+++ trunk/tests/phpunit/tests/date/dateI18n.php 2019-08-23 00:56:21 UTC (rev 45882)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -17,10 +17,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( strtotime( gmdate( DATE_RFC3339 ) ), strtotime( date_i18n( DATE_RFC3339, false, true ) ), 'The dates should be equal', 2 );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public function test_custom_timestamp_ignores_gmt_setting() {
- $this->assertEquals( '2012-12-01 00:00:00', date_i18n( 'Y-m-d H:i:s', strtotime( '2012-12-01 00:00:00' ) ) );
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> public function test_custom_timezone_setting() {
</span><span class="cx" style="display: block; padding: 0 10px"> update_option( 'timezone_string', 'America/Regina' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -85,8 +81,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @ticket 20973
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @dataProvider data_formats
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @ticket 20973
</del><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_date_i18n_handles_shorthand_formats( $short, $full ) {
</span><span class="cx" style="display: block; padding: 0 10px"> update_option( 'timezone_string', 'America/Regina' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -107,4 +104,65 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * @ticket 25768
+ */
+ public function test_should_return_wp_timestamp() {
+ update_option( 'timezone_string', 'Europe/Kiev' );
+
+ $datetime = new DateTimeImmutable( 'now', wp_timezone() );
+ $timestamp = $datetime->getTimestamp();
+ $wp_timestamp = $timestamp + $datetime->getOffset();
+
+ $this->assertEquals( $wp_timestamp, date_i18n( 'U' ), 2 );
+ $this->assertEquals( $timestamp, date_i18n( 'U', false, true ), 2 );
+ $this->assertEquals( $wp_timestamp, date_i18n( 'U', $wp_timestamp ) );
+ }
+
+ /**
+ * @ticket 43530
+ */
+ public function test_swatch_internet_time_with_wp_timestamp() {
+ update_option( 'timezone_string', 'America/Regina' );
+
+ $this->assertEquals( gmdate( 'B' ), date_i18n( 'B' ) );
+ }
+
+ /**
+ * @ticket 25768
+ */
+ public function test_should_handle_escaped_formats() {
+ $format = 'D | \D | \\D | \\\D | \\\\D | \\\\\D | \\\\\\D';
+
+ $this->assertEquals( gmdate( $format ), date_i18n( $format ) );
+ }
+
+ /**
+ * @ticket 25768
+ *
+ * @dataProvider dst_times
+ *
+ * @param string $time Time to test in Y-m-d H:i:s format.
+ * @param string $timezone PHP timezone string to use.
+ */
+ public function test_should_handle_dst( $time, $timezone ) {
+ update_option( 'timezone_string', $timezone );
+
+ $timezone = new DateTimeZone( $timezone );
+ $datetime = new DateTime( $time, $timezone );
+ $wp_timestamp = strtotime( $time );
+ $format = 'I ' . DATE_RFC3339;
+
+ $this->assertEquals( $datetime->format( $format ), date_i18n( $format, $wp_timestamp ) );
+ }
+
+ public function dst_times() {
+ return array(
+ 'Before DST start' => array( '2019-03-31 02:59:00', 'Europe/Kiev' ),
+ 'After DST start' => array( '2019-03-31 04:01:00', 'Europe/Kiev' ),
+ 'Before DST end' => array( '2019-10-27 02:59:00', 'Europe/Kiev' ),
+ 'After DST end' => array( '2019-10-27 04:01:00', 'Europe/Kiev' ),
+ );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre>
</div>
</div>
</body>
</html>