[wp-trac] [WordPress Trac] #25002: get_post_time() doesn't return correct GMT time if date_default_timezone_set is changed from UTC.
WordPress Trac
noreply at wordpress.org
Thu May 30 07:14:02 UTC 2019
#25002: get_post_time() doesn't return correct GMT time if
date_default_timezone_set is changed from UTC.
-------------------------------------------------+-------------------------
Reporter: johnregan3 | Owner: (none)
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: Awaiting
| Review
Component: Date/Time | Version: 1.2
Severity: normal | Resolution:
Keywords: needs-patch needs-testing bulk- | Focuses:
reopened |
-------------------------------------------------+-------------------------
Changes (by Rarst):
* keywords: needs-patch, needs-testing, bulk-reopened => needs-patch
needs-testing bulk-reopened
Comment:
Ok, so this touches on a lot of moving parts. I am generally proofing core
against sensitivity to default time zone (see #46483 ) so those parts are
getting slowly washed out.
I am looking at fixing up mysql2date (related #28992 ), but essentially
it's garbage in garbage out. It was originally written to work with
ambiguous timezone-less inputs and it accepts pretty much whatever, so it
borders on unrealistic to clean it up into something sane.
For posts my current plan is to introduce a new `get_post_datetime()`
function, that will instance a proper timezone-aware `DateTime` object
from a post. Using that will knock out ''a lot'' of issues with how post
times are read and output.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/25002#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list