Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/wp-admin/includes/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -1014,16 +1014,19 @@ function wp_dashboard_recent_posts( $args ) {

$time = get_the_time( 'U' );

if ( gmdate( 'Y-m-d', $time ) === $today ) {
$relative = __( '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 */
$date = get_the_date( __( 'M jS Y' ) );
} elseif ( gmdate( 'Y-m-d', $time ) === $today ) {
$date = __( 'Today' );
} elseif ( gmdate( 'Y-m-d', $time ) === $tomorrow ) {
$relative = __( 'Tomorrow' );
$date = __( 'Tomorrow' );
} elseif ( gmdate( 'Y', $time ) !== $year ) {
/* 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 );
$date = date_i18n( __( 'M jS Y' ), $time );
} else {
/* translators: Date and time format for recent posts on the dashboard, see https://www.php.net/manual/datetime.format.php */
$relative = date_i18n( __( 'M jS' ), $time );
$date = date_i18n( __( 'M jS' ), $time );
}

// Use the post edit link for those who can edit, the permalink otherwise.
Expand All @@ -1033,7 +1036,7 @@ function wp_dashboard_recent_posts( $args ) {
printf(
'<li><span>%1$s</span> <a href="%2$s" aria-label="%3$s">%4$s</a></li>',
/* translators: 1: Relative date, 2: Time. */
sprintf( _x( '%1$s, %2$s', 'dashboard' ), $relative, get_the_time() ),
sprintf( _x( '%1$s, %2$s', 'dashboard' ), $date, get_the_time() ),
$recent_post_link,
/* translators: %s: Post title. */
esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $draft_or_post_title ) ),
Expand Down
Loading