Skip to content

Commit

Permalink
Date/Time: Replace abbreviations for minutes in human_time_diff().
Browse files Browse the repository at this point in the history
This ensures that relative times are formatted the same way in both JS and PHP.

Follow-up to [1976], [2124], [4658], [41018], [56496].

Props wildworks.
Fixes #61535.

git-svn-id: https://develop.svn.wordpress.org/trunk@58600 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Jun 29, 2024
1 parent d3ac93a commit 57910f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/wp-includes/formatting.php
Original file line number Diff line number Diff line change
Expand Up @@ -3856,7 +3856,7 @@ function sanitize_email( $email ) {
* Determines the difference between two timestamps.
*
* The difference is returned in a human-readable format such as "1 hour",
* "5 mins", "2 days".
* "5 minutes", "2 days".
*
* @since 1.5.0
* @since 5.3.0 Added support for showing a difference in seconds.
Expand Down Expand Up @@ -3885,7 +3885,7 @@ function human_time_diff( $from, $to = 0 ) {
$mins = 1;
}
/* translators: Time difference between two dates, in minutes (min=minute). %s: Number of minutes. */
$since = sprintf( _n( '%s min', '%s mins', $mins ), $mins );
$since = sprintf( _n( '%s minutes', '%s minutes', $mins ), $mins );
} elseif ( $diff < DAY_IN_SECONDS && $diff >= HOUR_IN_SECONDS ) {
$hours = round( $diff / HOUR_IN_SECONDS );
if ( $hours <= 1 ) {
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/formatting/humanTimeDiff.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function data_human_time_diff() {
'Test a difference of 37 seconds.',
),
array(
'5 mins',
'5 minutes',
new DateTime( '2016-01-01 12:05:00' ),
'Test a difference of 5 minutes.',
),
Expand Down

0 comments on commit 57910f6

Please sign in to comment.