Changeset 45573
- Timestamp:
- 06/28/2019 06:43:27 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r45569 r45573 3609 3609 * 3610 3610 * @since 1.5.0 3611 * @since 5.3.0 Added support for showing a difference in seconds. 3611 3612 * 3612 3613 * @param int $from Unix timestamp from which the difference begins. … … 3621 3622 $diff = (int) abs( $to - $from ); 3622 3623 3623 if ( $diff < HOUR_IN_SECONDS ) { 3624 if ( $diff < MINUTE_IN_SECONDS ) { 3625 $secs = $diff; 3626 if ( $secs <= 1 ) { 3627 $secs = 1; 3628 } 3629 /* translators: Time difference between two dates, in seconds. %s: Number of seconds */ 3630 $since = sprintf( _n( '%s second', '%s seconds', $secs ), $secs ); 3631 } elseif ( $diff < HOUR_IN_SECONDS && $diff >= MINUTE_IN_SECONDS ) { 3624 3632 $mins = round( $diff / MINUTE_IN_SECONDS ); 3625 3633 if ( $mins <= 1 ) { -
trunk/tests/phpunit/tests/formatting/HumanTimeDiff.php
r41018 r45573 20 20 function data_test_human_time_diff() { 21 21 return array( 22 array( 23 '37 seconds', 24 new DateTime( '2016-01-01 12:00:37' ), 25 'Test a difference of 37 seconds.', 26 ), 22 27 array( 23 28 '5 mins',
Note: See TracChangeset
for help on using the changeset viewer.