[wp-trac] Re: [WordPress Trac] #9285: making sure post_date and post_date_gmt are correct

WordPress Trac wp-trac at lists.automattic.com
Thu Mar 5 23:26:10 GMT 2009


#9285: making sure post_date and post_date_gmt are correct
--------------------------+-------------------------------------------------
 Reporter:  hailin        |       Owner:  anonymous 
     Type:  defect (bug)  |      Status:  new       
 Priority:  normal        |   Milestone:  Unassigned
Component:  General       |     Version:            
 Severity:  normal        |    Keywords:            
--------------------------+-------------------------------------------------

Comment(by hailin):

 The user exported posts from local WordPress installation, and its
 timezone is set UTC. Before export, the user scheduled some future posts.
 After export, the XML file has:
 <wp:post_date>2009-04-04 10:00:00<wp:post_date>
 <wp:post_date_gmt>2009-04-04 10:00:00<wp:post_date_gmt>
 This is correct since his timezone is UTC.

 Now, the user imports the XML to his live blog, which has timezone set to:
 UTC-5.
 He checks the scheduled dates and saw "scheduled for 2009-04-04 10:00:00".
 Of course, this is misleading because internally, we used post_date_gmt to
 derive the timestamp. So the post ended up being published 5 hours
 earlier.

 My proposed fix is to create post_date_gmt from post_date, to retain
 user's perception of date while maintaining correct internal logic, during
 import.

 Another alternative is to enforce this rule in wp_insert_post, but that
 maybe a little too strict.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/9285#comment:2>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list