WordPress.org

Make WordPress Core

Changeset 40325 for branches/4.7


Ignore:
Timestamp:
03/24/2017 05:52:02 PM (2 years ago)
Author:
swissspidy
Message:

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.

Merges [40284] and [40324] to the 4.7 branch.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r40137 r40325  
    13941394            // field with the site's timezone offset applied.
    13951395            if ( '0000-00-00 00:00:00' === $post->post_date_gmt ) {
    1396                 $post_date_gmt = date( 'Y-m-d H:i:s', strtotime( $post->post_date ) - ( get_option( 'gmt_offset' ) * 3600 ) );
     1396                $post_date_gmt = get_gmt_from_date( $post->post_date );
    13971397            } else {
    13981398                $post_date_gmt = $post->post_date_gmt;
Note: See TracChangeset for help on using the changeset viewer.