Use the MONTH_IN_SECONDS
constant added in [33698] for the month representation in human_time_diff()
logic.
Props tyxla. Fixes #34602. git-svn-id: https://develop.svn.wordpress.org/trunk@35555 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
5e614a08f8
commit
207ab0db7d
@ -2844,13 +2844,13 @@ function human_time_diff( $from, $to = '' ) {
|
||||
if ( $days <= 1 )
|
||||
$days = 1;
|
||||
$since = sprintf( _n( '%s day', '%s days', $days ), $days );
|
||||
} elseif ( $diff < 30 * DAY_IN_SECONDS && $diff >= WEEK_IN_SECONDS ) {
|
||||
} elseif ( $diff < MONTH_IN_SECONDS && $diff >= WEEK_IN_SECONDS ) {
|
||||
$weeks = round( $diff / WEEK_IN_SECONDS );
|
||||
if ( $weeks <= 1 )
|
||||
$weeks = 1;
|
||||
$since = sprintf( _n( '%s week', '%s weeks', $weeks ), $weeks );
|
||||
} elseif ( $diff < YEAR_IN_SECONDS && $diff >= 30 * DAY_IN_SECONDS ) {
|
||||
$months = round( $diff / ( 30 * DAY_IN_SECONDS ) );
|
||||
} elseif ( $diff < YEAR_IN_SECONDS && $diff >= MONTH_IN_SECONDS ) {
|
||||
$months = round( $diff / MONTH_IN_SECONDS );
|
||||
if ( $months <= 1 )
|
||||
$months = 1;
|
||||
$since = sprintf( _n( '%s month', '%s months', $months ), $months );
|
||||
|
Loading…
Reference in New Issue
Block a user