[wp-trac] [WordPress Trac] #53294: Adding filter hook to current_time() function

WordPress Trac noreply at wordpress.org
Mon May 31 08:36:18 UTC 2021


#53294: Adding filter hook to current_time() function
-------------------------+------------------------------
 Reporter:  wpvar        |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Date/Time    |     Version:  trunk
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:  accessibility
-------------------------+------------------------------

Comment (by wpvar):

 Yes saving time stamps other than PHPs native stamp (gregorian) into
 database is absolute disaster and it will cause unresolvable problems and
 conflicts, Therefore `wp_date` is ideal function, its functionality is to
 retrieve not store dates and also we can get stamp by $timestamp variable
 in hook and validate it to be gregorian otherwise ignore any date changes.
 there is almost 600 years gap between solar and gregorian dates and its
 not complicate to validate incoming timestamp.
 Based on your explanation I agree its not a good idea to modify
 current_time and problems may it cause, Limiting its front-end usage by
 improving documentation or consider future deprecation may be much better
 approaches.

 Thank you for your explanation ;)

 Replying to [comment:5 Rarst]:
 > I think we need a carefully considered deprecation pass for much of old
 Date/Time bits, just been busy with other things. :) Will get to it
 eventually.
 >
 > My concern is that dragging localization into computation layer is
 unpredictable and harmful. There is no flexibility to concept of "current
 time as reported by PHP" (other than legacy WP timestamp silliness, sigh)
 and I don't think it should be introduced or enabled.
 >
 > I do think that users should be able to localize time display to
 whatever system they would like!
 >
 > But underlying computation is inherently constrained by PHP language and
 that's not something to mess with for presentation purposes. The damage
 that WP caused when it corrupted PHP mechanics by introducing offset
 timestamps took many years to mitigate and remainders will be around
 forever.

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


More information about the wp-trac mailing list