[wp-trac] [WordPress Trac] #25365: timeAgo attribute for revisions produces the wrong result due to missing UTC in strtotime
WordPress Trac
noreply at wordpress.org
Thu Jun 26 13:55:56 UTC 2014
#25365: timeAgo attribute for revisions produces the wrong result due to missing
UTC in strtotime
--------------------------+-----------------------
Reporter: biranit | Owner:
Type: defect (bug) | Status: reopened
Priority: normal | Milestone:
Component: Revisions | Version: 3.6.1
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+-----------------------
Comment (by buley):
`date_default_timezone_set('Asia/Jerusalem');` is in fact the issue. For
me of course it's my own `America/New_York`, needed for a 3rd party Google
Analytics library on which we rely.
In a setup where WordPress is a component in a larger system, using
`date_default_timezone_set()` is commonplace. In fact if you don't set
this you'll get the "It is not safe to rely on the system's timezone
settings" warning telling you that you should use this, or "the
date.timezone setting" which I presume will have a similar effect.
A proposed "fix" is can be as simple as using `$modified` for the
`human_time_diff()`. Otherwise, removing the `date_default_timezone_set()`
call seems necessary (which seems unnecessary).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/25365#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list