projects
/
horde.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6e78b98
)
Add days and weeks to relative time.
author
Jan Schneider
<jan@horde.org>
Wed, 2 Dec 2009 23:37:21 +0000
(
00:37
+0100)
committer
Jan Schneider
<jan@horde.org>
Thu, 3 Dec 2009 10:14:42 +0000
(11:14 +0100)
framework/Date/lib/Horde/Date/Utils.php
patch
|
blob
|
history
diff --git
a/framework/Date/lib/Horde/Date/Utils.php
b/framework/Date/lib/Horde/Date/Utils.php
index
919bdde
..
3598707
100644
(file)
--- a/
framework/Date/lib/Horde/Date/Utils.php
+++ b/
framework/Date/lib/Horde/Date/Utils.php
@@
-95,6
+95,16
@@
class Horde_Date_Utils
return sprintf(_("yesterday at %s"), $date->strftime($time_format));
}
+ $delta = round($delta / 24);
+ if ($delta < 7) {
+ return sprintf(_("%d days ago"), $delta);
+ }
+
+ if (round($delta / 7) < 5) {
+ $delta = round($delta / 7);
+ return sprintf(ngettext("%d week ago", "%d weeks ago", $delta), $delta);
+ }
+
// Default to the user specified date format.
$date = new Horde_Date($timestamp);
return $date->strftime($date_format);