Fix years calculation and use properties instead of formatting function for time difference calculation.

develop
Sven Slootweg 12 years ago
parent bd3db37ea5
commit 7a933cd60d

@ -197,13 +197,13 @@ function time_ago($timestamp, $locale)
$date2 = new DateTime("now", new DateTimeZone("GMT")); $date2 = new DateTime("now", new DateTimeZone("GMT"));
$interval = $date1->diff($date2); $interval = $date1->diff($date2);
$years = (int)$interval->format("%G"); $years = (int)$interval->y;
$months = (int)$interval->format("%m"); $months = (int)$interval->m;
$weeks = (int)$interval->format("%U"); $weeks = (int)$interval->format("%U");
$days = (int)$interval->format("%d"); $days = (int)$interval->d;
$hours = (int)$interval->format("%H"); $hours = (int)$interval->h;
$minutes = (int)$interval->format("%i"); $minutes = (int)$interval->i;
$seconds = (int)$interval->format("%S"); $seconds = (int)$interval->s;
if($years > 1) if($years > 1)
{ {

Loading…
Cancel
Save