mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 04:40:26 +00:00
REST API: Use get_gmt_from_date() when preparing a draft post for response.
This prevents wrong dates when dealing with DST, see [40115] and [40284]. Props nerrad. Fixes #40136. git-svn-id: https://develop.svn.wordpress.org/trunk@40324 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1401,7 +1401,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
||||
// #38883). In this case, shim the value based on the `post_date`
|
||||
// field with the site's timezone offset applied.
|
||||
if ( '0000-00-00 00:00:00' === $post->post_date_gmt ) {
|
||||
$post_date_gmt = date( 'Y-m-d H:i:s', strtotime( $post->post_date ) - ( get_option( 'gmt_offset' ) * 3600 ) );
|
||||
$post_date_gmt = get_gmt_from_date( $post->post_date );
|
||||
} else {
|
||||
$post_date_gmt = $post->post_date_gmt;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user