Date/Time: Save a call to wp_timezone in mysql2date.

Save a call to wp_timezone in mysql2date by saving the timezone to a variable and pass it into wp_date function call.

Props spacedmonkey, costdev, SergeyBiryukov, audrasjb.
Fixes #57705.
Built from https://develop.svn.wordpress.org/trunk@55514


git-svn-id: http://core.svn.wordpress.org/trunk@55046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
spacedmonkey 2023-03-10 15:36:20 +00:00
parent 39e6d6d348
commit 49692206c0
2 changed files with 4 additions and 3 deletions

View File

@ -32,7 +32,8 @@ function mysql2date( $format, $date, $translate = true ) {
return false;
}
$datetime = date_create( $date, wp_timezone() );
$timezone = wp_timezone();
$datetime = date_create( $date, $timezone );
if ( false === $datetime ) {
return false;
@ -44,7 +45,7 @@ function mysql2date( $format, $date, $translate = true ) {
}
if ( $translate ) {
return wp_date( $format, $datetime->getTimestamp() );
return wp_date( $format, $datetime->getTimestamp(), $timezone );
}
return $datetime->format( $format );

View File

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