From 970d4d7a4a5c3dbd68ae2337d7300452a13df157 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 21 May 2015 10:19:07 +0200 Subject: [PATCH] Fix that time-until doesn't show negative partial time in the dashboard refs #6778 --- library/Icinga/Date/DateFormatter.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/Icinga/Date/DateFormatter.php b/library/Icinga/Date/DateFormatter.php index 8ea8e2b3c..411c19535 100644 --- a/library/Icinga/Date/DateFormatter.php +++ b/library/Icinga/Date/DateFormatter.php @@ -202,6 +202,9 @@ class DateFormatter public static function timeUntil($time, $timeOnly = false) { list($type, $until, $invert) = static::diff($time); + if ($invert) { + $until = '-' . $until; + } if ($timeOnly) { return $until; } @@ -217,7 +220,7 @@ class DateFormatter case static::RELATIVE: $formatted = sprintf( t('in %s', 'An event will happen after the given time interval has elapsed'), - $invert ? ('-' . $until) : $until + $until ); break; case static::TIME: