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

WordPress Trac noreply at wordpress.org
Mon Oct 21 16:43:29 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:  Awaiting Review
Component:  Date/Time     |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by Rarst):

 > I might be missing something, but this is the behavior I would expect
 here, rather than what 5.2.4 did.

 No, I think the report is correct about that being wrong. The ''relative
 time passed'' is irrelevant to time zone. If post was created a minute ago
 then that was ''a minute ago'' regardless of time zone. I don't know if it
 related to UTC time though, I'll look through things on fresh head.

 I think what actually regressed is explicitly retrieving UTC time is now
 slipping (as per unit test). In the past the ''local'' time slipped with
 time zone changed. Right now ''I think'' both are slipping, because we
 instantiate from local time.

 I'll probably add an argument to `get_post_datetime()` do we want to
 instantiate from local or UTC time. It's kind of ''stupid'' because there
 should be no difference if it wasn't broken, but we'll be able to stop UTC
 from slipping at least (so fix regression, if not underlying issue).

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


More information about the wp-trac mailing list