diff options
author | Jan-Christoph Borchardt <JanCBorchardt@fsfe.org> | 2011-08-05 08:19:51 +0200 |
---|---|---|
committer | Jan-Christoph Borchardt <JanCBorchardt@fsfe.org> | 2011-08-05 08:19:51 +0200 |
commit | 6d5cb13018197355978230a5b59790fa31ccc6fd (patch) | |
tree | d68b6d38a0ce72989a6d9733b8ff279ee4536e54 /lib/template.php | |
parent | 193b9c9386eee28bc5d96e7c6c638803b517ba5c (diff) | |
download | nextcloud-server-6d5cb13018197355978230a5b59790fa31ccc6fd.tar.gz nextcloud-server-6d5cb13018197355978230a5b59790fa31ccc6fd.zip |
fixed relative time calculation
Diffstat (limited to 'lib/template.php')
-rw-r--r-- | lib/template.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/template.php b/lib/template.php index fe173f609b2..45008940e99 100644 --- a/lib/template.php +++ b/lib/template.php @@ -82,19 +82,19 @@ function relative_modified_date($timestamp) { $diffdays = round($diffhours/24); $diffmonths = round($diffdays/31); $diffyears = round($diffdays/365); + if($timediff < 60) { return 'seconds ago'; } else if($timediff < 120) { return '1 minute ago'; } else if($timediff < 3600) { return $diffminutes.' minutes ago'; } //else if($timediff < 7200) { return '1 hour ago'; } //else if($timediff < 86400) { return $diffhours.' hours ago'; } - else if($timediff < 86400) { return 'today'; } - else if($timediff < 172800) { return 'yesterday'; } + else if((date(G)-$diffhours) > 0) { return 'today'; } + else if((date(G)-$diffhours) > -24) { return 'yesterday'; } else if($timediff < 2678400) { return $diffdays.' days ago'; } else if($timediff < 5184000) { return 'last month'; } - //else if($timediff < 31556926) { return $diffmonths.' months ago'; } - else if($timediff < 31556926) { return 'months ago'; } + else if((date(n)-$diffmonths) > 0) { return 'months ago'; } else if($timediff < 63113852) { return 'last year'; } - else { return $diffyears.' years ago'; } + else { return 'years ago'; } } |