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@55343


git-svn-id: http://core.svn.wordpress.org/trunk@54876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
spacedmonkey 2023-02-14 21:41:20 +00:00
parent 14f8608af9
commit 0dc9b1a9b8
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.2-beta2-55342';
$wp_version = '6.2-beta2-55343';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.