[wp-trac] [WordPress Trac] #38940: current_time() expects that date_default_timezone_set is never used

WordPress Trac noreply at wordpress.org
Tue May 2 12:42:18 UTC 2017


#38940: current_time() expects that date_default_timezone_set is never used
------------------------------------------------+--------------------------
 Reporter:  marco.marsala                       |       Owner:
     Type:  defect (bug)                        |      Status:  new
 Priority:  normal                              |   Milestone:  Awaiting
Component:  Date/Time                           |  Review
 Severity:  normal                              |     Version:  4.6.1
 Keywords:  has-patch dev-feedback 2nd-opinion  |  Resolution:
                                                |     Focuses:
------------------------------------------------+--------------------------

Comment (by jdgrimes):

 The more I work with dates and times in WordPress, the more I think that
 its date and time API needs to be completely reworked. It is usable to a
 certain degree when working with GMT times, but if you want to do
 something relative to the site's timezone, it does just about everything
 wrong. The method of converting between timezones in `current_time()`, for
 example, always uses GMT offsets, instead of actual timezones (meaning
 that if a timezone observes DST, or has any other quirks, things won't
 come out correctly). What needs to really happen is using PHP's datetime
 API, instead of all of these hacks. Probably `current_time()` needs to
 retain current behavior for back-compat, be deprecated, and a new helper
 function introduced. But that would really be for a separate ticket.

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


More information about the wp-trac mailing list