From cf0a453f08726aa4a326fdba746e12e93032a4d8 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 16 Jan 2020 00:26:08 +0000 Subject: [PATCH] Date/Time: Use `wp_date()` to display the correct time of the next DST transition in Timezone setting on General Settings screen. Props Rarst, autotutorial. Fixes #49038. git-svn-id: https://develop.svn.wordpress.org/trunk@47073 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/options-general.php | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/src/wp-admin/options-general.php b/src/wp-admin/options-general.php index d5c3d167c4..cbde314eef 100644 --- a/src/wp-admin/options-general.php +++ b/src/wp-admin/options-general.php @@ -276,34 +276,20 @@ if ( empty( $tzstring ) ) { // Create a UTC+- zone if no timezone string exists ?>
$right_now ) { - $found = true; - break; - } - } - - if ( $found ) { + // 0 index is the state at current time, 1 index is the next transition, if any. + if ( ! empty( $transitions[1] ) ) { echo ' '; - $message = $tr['isdst'] ? + $message = $transitions[1]['isdst'] ? /* translators: %s: Date and time. */ __( 'Daylight saving time begins on: %s.' ) : /* translators: %s: Date and time. */ __( 'Standard time begins on: %s.' ); - // Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n(). printf( $message, - '' . date_i18n( - __( 'F j, Y' ) . ' ' . __( 'g:i a' ), - $tr['ts'] + ( $tz_offset - $tr['offset'] ) - ) . '' + '' . wp_date( __( 'F j, Y' ) . ' ' . __( 'g:i a' ), $transitions[1]['ts'] ) . '' ); } else { _e( 'This timezone does not observe daylight saving time.' );