Make WordPress Core

Changeset 58600

Timestamp:
06/29/2024 09:29:08 AM (9 days ago)
Author:
SergeyBiryukov
Message:

Date/Time: Replace abbreviations for minutes in human_time_diff().

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.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/formatting.php

    r58471 r58600  
    38573857 *
    38583858 * The difference is returned in a human-readable format such as "1 hour",
    3859  * "5 mins", "2 days".
     3859 * "5 mins", "2 days".
    38603860 *
    38613861 * @since 1.5.0
     
    38863886        }
    38873887        /* translators: Time difference between two dates, in minutes (min=minute). %s: Number of minutes. */
    3888         $since = sprintf( _n( '%s min', '%s mins', $mins ), $mins );
     3888        $since = sprintf( _n( '%s mins', $mins ), $mins );
    38893889    } elseif ( $diff < DAY_IN_SECONDS && $diff >= HOUR_IN_SECONDS ) {
    38903890        $hours = round( $diff / HOUR_IN_SECONDS );
  • trunk/tests/phpunit/tests/formatting/humanTimeDiff.php

    r55562 r58600  
    2828            ),
    2929            array(
    30                 '5 mins',
     30                '5 mins',
    3131                new DateTime( '2016-01-01 12:05:00' ),
    3232                'Test a difference of 5 minutes.',
Note: See TracChangeset for help on using the changeset viewer.