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.
Built from https://develop.svn.wordpress.org/trunk@40324


git-svn-id: http://core.svn.wordpress.org/trunk@40231 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Pascal Birchler 2017-03-24 17:32:46 +00:00
parent 37a638ae8a
commit 0d42f8549c
2 changed files with 2 additions and 2 deletions

View File

@ -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;
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.8-alpha-40323';
$wp_version = '4.8-alpha-40324';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.