[wp-trac] [WordPress Trac] #64496: Type Error with gmdate() in dashboard Activity widget
WordPress Trac
noreply at wordpress.org
Tue Jan 13 20:31:18 UTC 2026
#64496: Type Error with gmdate() in dashboard Activity widget
----------------------------+--------------------------
Reporter: vanhoucke | Owner: westonruter
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: 7.0
Component: Administration | Version: 6.9
Severity: normal | Resolution:
Keywords: has-patch | Focuses: ui
----------------------------+--------------------------
Changes (by westonruter):
* owner: (none) => westonruter
* status: new => reviewing
Comment:
@sabernhardt I added your patch to a [https://github.com/WordPress
/wordpress-develop/pull/10729 PR], but I also iterated on it a bit with a
proposal. What if we just use the full date format when `$relative`
doesn't return an `int`?
{{{#!diff
--- a/src/wp-admin/includes/dashboard.php
+++ b/src/wp-admin/includes/dashboard.php
@@ -1014,7 +1014,10 @@ function wp_dashboard_recent_posts( $args ) {
$time = get_the_time( 'U' );
- if ( gmdate( 'Y-m-d', $time ) === $today ) {
+ if ( ! is_int( $time ) ) {
+ /* translators: Date and time format for
recent posts on the dashboard, from a different calendar year, see
https://www.php.net/manual/datetime.format.php */
+ $relative = date_i18n( __( 'M jS Y' ),
$time );
+ } elseif ( gmdate( 'Y-m-d', $time ) === $today ) {
$relative = __( 'Today' );
} elseif ( gmdate( 'Y-m-d', $time ) === $tomorrow
) {
$relative = __( 'Tomorrow' );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64496#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list