diff --git a/library/Icinga/Date/DateFormatter.php b/library/Icinga/Date/DateFormatter.php
index a3a0a7cd4..cc8a2d3a4 100644
--- a/library/Icinga/Date/DateFormatter.php
+++ b/library/Icinga/Date/DateFormatter.php
@@ -149,12 +149,13 @@ class DateFormatter
*
* @param int|float $time
* @param bool $timeOnly
+ * @param bool $requireTime
*
* @return string
*/
- public static function timeAgo($time, $timeOnly = false)
+ public static function timeAgo($time, $timeOnly = false, $requireTime = false)
{
- list($type, $ago, $invert) = static::diff($time);
+ list($type, $ago, $invert) = static::diff($time, $requireTime);
if ($timeOnly) {
return $ago;
}
@@ -185,12 +186,13 @@ class DateFormatter
*
* @param int|float $time
* @param bool $timeOnly
+ * @param bool $requireTime
*
* @return string
*/
- public static function timeSince($time, $timeOnly = false)
+ public static function timeSince($time, $timeOnly = false, $requireTime = false)
{
- list($type, $since, $invert) = static::diff($time);
+ list($type, $since, $invert) = static::diff($time, $requireTime);
if ($timeOnly) {
return $since;
}
diff --git a/library/Icinga/Web/View/helpers/format.php b/library/Icinga/Web/View/helpers/format.php
index 483b11338..400858357 100644
--- a/library/Icinga/Web/View/helpers/format.php
+++ b/library/Icinga/Web/View/helpers/format.php
@@ -38,25 +38,25 @@ $this->addHelperFunction('formatTime', function ($time) {
return DateFormatter::formatTime($time);
});
-$this->addHelperFunction('timeAgo', function ($time, $timeOnly = false) {
+$this->addHelperFunction('timeAgo', function ($time, $timeOnly = false, $requireTime = false) {
if (! $time) {
return '';
}
return sprintf(
'%s',
DateFormatter::formatDateTime($time),
- DateFormatter::timeAgo($time, $timeOnly)
+ DateFormatter::timeAgo($time, $timeOnly, $requireTime)
);
});
-$this->addHelperFunction('timeSince', function ($time, $timeOnly = false) {
+$this->addHelperFunction('timeSince', function ($time, $timeOnly = false, $requireTime = false) {
if (! $time) {
return '';
}
return sprintf(
'%s',
DateFormatter::formatDateTime($time),
- DateFormatter::timeSince($time, $timeOnly)
+ DateFormatter::timeSince($time, $timeOnly, $requireTime)
);
});