Fix time intervals on report site not displaying correctly

Before this would display values such as "0 minute ago" and "1 minutes
ago".
This commit is contained in:
Keir Nellyer 2016-07-09 23:48:14 -04:00
parent b808121d68
commit e607960b6a

View File

@ -319,22 +319,22 @@ function approximateHumanInterval($interval)
{ {
if ($interval->y > 0) if ($interval->y > 0)
{ {
$humanString = $interval->y . ' year' . ($interval->y != 0 ? 's' : ''); $humanString = $interval->y . ' year' . ($interval->y != 1 ? 's' : '');
} else if ($interval->m > 0) } else if ($interval->m > 0)
{ {
$humanString = $interval->m . ' month' . ($interval->m != 0 ? 's' : ''); $humanString = $interval->m . ' month' . ($interval->m != 1 ? 's' : '');
} }
else if ($interval->d > 0) else if ($interval->d > 0)
{ {
$humanString = $interval->d . ' day' . ($interval->d != 0 ? 's' : ''); $humanString = $interval->d . ' day' . ($interval->d != 1 ? 's' : '');
} }
else if ($interval->h > 0) else if ($interval->h > 0)
{ {
$humanString = $interval->h . ' hour' . ($interval->h != 0 ? 's' : ''); $humanString = $interval->h . ' hour' . ($interval->h != 1 ? 's' : '');
} }
else else
{ {
$humanString = $interval->i . ' minute' . ($interval->i != 0 ? 's' : ''); $humanString = $interval->i . ' minute' . ($interval->i != 1 ? 's' : '');
} }
return $humanString; return $humanString;