Script Loader: Add a timezone offset display value to wp.date.setSettings.

Fixes a bug in the editor where the offset values are displayed as decimals rather than minutes.

Props afercia, get_dave.
Fixes #60105.
Built from https://develop.svn.wordpress.org/trunk@57556


git-svn-id: http://core.svn.wordpress.org/trunk@57057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
youknowriad 2024-02-08 07:08:13 +00:00
parent 15ab0f672f
commit cd2716ff72
2 changed files with 7 additions and 4 deletions

View File

@ -419,6 +419,8 @@ function wp_default_packages_inline_scripts( $scripts ) {
$timezone_abbr = $timezone_date->format( 'T' ); $timezone_abbr = $timezone_date->format( 'T' );
} }
$gmt_offset = get_option( 'gmt_offset', 0 );
$scripts->add_inline_script( $scripts->add_inline_script(
'wp-date', 'wp-date',
sprintf( sprintf(
@ -475,9 +477,10 @@ function wp_default_packages_inline_scripts( $scripts ) {
'datetimeAbbreviated' => __( 'M j, Y g:i a' ), 'datetimeAbbreviated' => __( 'M j, Y g:i a' ),
), ),
'timezone' => array( 'timezone' => array(
'offset' => (float) get_option( 'gmt_offset', 0 ), 'offset' => (float) $gmt_offset,
'string' => $timezone_string, 'offsetFormatted' => str_replace( array( '.25', '.5', '.75' ), array( ':15', ':30', ':45' ), (string) $gmt_offset ),
'abbr' => $timezone_abbr, 'string' => $timezone_string,
'abbr' => $timezone_abbr,
), ),
) )
) )

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.5-alpha-57555'; $wp_version = '6.5-alpha-57556';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.