[wp-trac] [WordPress Trac] #54132: get_calendar functions depends on gmdate instead of date

WordPress Trac noreply at wordpress.org
Thu May 26 15:17:16 UTC 2022


#54132: get_calendar functions depends on gmdate instead of date
--------------------------+------------------------------
 Reporter:  voregnev      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Date/Time     |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by SergeyBiryukov):

 Hi there, thanks for the ticket!

 Using `gmdate()` is intentional as per [45424] / #46438 & #44491, see
 [https://make.wordpress.org/core/2019/09/23/date-time-improvements-wp-5-3/
 Date/Time component improvements in WordPress 5.3] for more details.

 Using `date()` instead would actually produce a WPCS error:
 {{{
 ----------------------------------------------------------------------
 FOUND 1 ERROR AFFECTING 1 LINE
 ----------------------------------------------------------------------
 2271 | ERROR | date() is affected by runtime timezone changes which
      |       | can cause date/time to be incorrectly displayed. Use
      |       | gmdate() instead.
      |       | (WordPress.DateTime.RestrictedFunctions.date_date)
 ----------------------------------------------------------------------
 }}}

 There might still be a bug here where the timezone is not applied
 correctly, but I think the solution would look different.

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


More information about the wp-trac mailing list