[wp-trac] [WordPress Trac] #48384: get_post_time returns wrong value after timezone switch

WordPress Trac noreply at wordpress.org
Wed Oct 23 02:47:43 UTC 2019


#48384: get_post_time returns wrong value after timezone switch
-------------------------------------------------+-------------------------
 Reporter:  david.binda                          |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  5.3
Component:  Date/Time                            |     Version:  trunk
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests commit      |     Focuses:
  dev-feedback                                   |
-------------------------------------------------+-------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:12 Rarst]:
 > > Better to get to the bottom of the "human time diff" on the Posts
 screen not working well with the patch.
 >
 > Could you elaborate what is still the issue?

 Sure :) The unit tests pass, but we were testing the scenario from the
 ticket description:
 > The issue is visible on post listing in wp-admin/edit.php, where post
 created during the UTC+0 timezone being set, are marked as 2 hours ago,
 after changing the timezone to UTC+2.
 and noticed some weirdness
 ([https://wordpress.slack.com/archives/C02RQBWTW/p1571767673042500 Slack
 thread] for reference).

 My steps:
 * Set the timezone to UTC+0.
 * Create a draft post.
 * Set the timezone to UTC+2.
 * View the Date column in the Posts list.

 Without the patch, the Date column shows:
 * `Last Modified 6 mins ago` before the timezone change.
 * `Last Modified 2 hours ago` after the timezone change.

 With the patch, the Date column shows:
 * `Last Modified 2019/10/23` both before and after the timezone change.

 I've noticed that [source:tags/5.2.4/src/wp-admin/includes/class-wp-posts-
 list-table.php?marks=1062#L1053 get_post_time()] returns false there, and
 the output defaults to `mysql2date( __( 'Y/m/d' ), $m_time )`, instead of
 `human_time_diff( $time )`, but haven't yet tracked it down further.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48384#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list