[wp-trac] [WordPress Trac] #34835: date_i18n() produces invalid output for numerical time zones
WordPress Trac
noreply at wordpress.org
Thu Dec 3 12:55:28 UTC 2015
#34835: date_i18n() produces invalid output for numerical time zones
--------------------------+-----------------------------
Reporter: Rarst | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Date/Time | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
`date_i18n()` only attempts to use `get_option( 'timezone_string' )` for
timezone information. This option is empty when numerical offset is saved
as time zone in settings.
Code to reproduce:
{{{
// Kiev
var_dump( get_option( 'timezone_string' ), get_option( 'gmt_offset' ) );
// 'Europe/Kiev', 2
var_dump( date_i18n( DATE_W3C, get_the_date( 'U' ) ) ); //
2015-12-03T12:22:22+02:00 correct
// UTC+2
var_dump( get_option( 'timezone_string' ), get_option( 'gmt_offset' ) );
// '', '2'
var_dump( date_i18n( DATE_W3C, get_the_date( 'U' ) ) ); //
2015-12-03T12:22:22+00:00 wrong
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34835>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list