[wp-trac] [WordPress Trac] #30429: wp.newPost gets non-GMT date calculation wrong

WordPress Trac noreply at wordpress.org
Fri Nov 21 00:04:02 UTC 2014


#30429: wp.newPost gets non-GMT date calculation wrong
--------------------------+-----------------------------
 Reporter:  smerriman     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 In class-wp-xmlrpc-server.php, there is a bug with the calculation of
 dates if a post_date is set.

 {{{
 if ( ! empty( $dateCreated ) ) {
         $post_data['post_date'] = get_date_from_gmt( iso8601_to_datetime(
 $dateCreated ) );
         $post_data['post_date_gmt'] = iso8601_to_datetime( $dateCreated,
 'GMT' );
 }
 }}}

 `get_date_from_gmt` assumes the parameter passed is a GMT string.
 `iso8601_to_datetime( $dateCreated )`, however, is the local time. It
 should have the GMT parameter as per the next line to ensure the two dates
 are always in sync; currently the first one is always incorrect.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30429>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list