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

WordPress Trac noreply at wordpress.org
Mon May 31 04:22:47 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):

 Thanks for checking issue out @Rarst
 Basically what we want to achieve is converting front-end dates. for
 example:

 ||**Gregorian**||**Solar**||**Lunar**||**...**||
 ||2021/05/31||1400/03/10||1442/10/19||...||

 [https://en.wikipedia.org/wiki/List_of_calendars#:~:text=Calendars%20fall%20into%20four%20types,than%20lunar%20or%20solar%20observations.
 List of calendars]


 >So far this still looks to me like it belongs to the localization layer.
 If the third party plugins output time directly to user bypassing the
 localization, that's probably on them to improve.

 I totally agree with you on this, Best solution would be for developers to
 do not use current_time on front-end (But they are widely using anyway).
 Maybe checking right usage of `current_time` on hosted plugins/themes
 during validation process would help or adding extra description on
 `current_time`s
 [https://developer.wordpress.org/reference/functions/current_time/
 reference page] as a reminder to avoid usage of `current_time` on front-
 end generated dates and instead using `wp_date`.

 Replying to [comment:3 Rarst]:
 > Your plugin doesn't have a readme in English, so I can't read that
 unfortunately.
 >
 > So far this still looks to me like it belongs to the localization layer.
 If the third party plugins output time directly to user bypassing the
 localization, that's probably on them to improve.
 >
 > To be honest I have trouble even thinking through how many things might
 break if you start changing up `current_time()`. And you are still not
 giving me ''actual example'' of what you want to achieve there.

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


More information about the wp-trac mailing list