Bug in code for display of days/hours
-
This plugin will report dates like “4 weeks 3 weeks” when it means “4 weeks 3 days,” and similarly for days/hours. There is a simple fix which I’ve included below in unified patch format. I hope this can be included upstream so it won’t have to be reapplied on upgrade.
--- wp-relative-date.php 2016-09-21 12:09:46.000000000 -0400 +++ wp-relative-date.php.fixed 2017-04-09 14:49:55.062825466 -0400 @@ -358,14 +358,14 @@ // Weeks and days $relative_date .= ( $relative_date?$divider:'' ) . $weeks . ' ' . ( $weeks>1?$week_plural:$week_singular ); - if ( ( $days > 0 ) && ( $depth == 2 ) ) { $relative_date .= ( $relative_date?$divider:'' ) . $days . ' '.( $days>1?$week_plural:$week_singular );} + if ( ( $days > 0 ) && ( $depth == 2 ) ) { $relative_date .= ( $relative_date?$divider:'' ) . $days . ' '.( $days>1?$day_plural:$day_singular );} } elseif ( $days > 0 ) { // days and hours $relative_date .= ( $relative_date?$divider:'' ) . $days . ' ' . ( $days>1?$day_plural:$day_singular ); - if ( ( $hours > 0 ) && ( $depth == 2 ) ) { $relative_date .= ( $relative_date?$divider:'' ) . $hours . ' ' . ( $hours>1?$day_plural:$day_singular ); } + if ( ( $hours > 0 ) && ( $depth == 2 ) ) { $relative_date .= ( $relative_date?$divider:'' ) . $hours . ' ' . ( $hours>1?$hour_plural:$hour_singular ); } } elseif ( $hours > 0 ) {
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Bug in code for display of days/hours’ is closed to new replies.