Fix that time-until doesn't show negative partial time in the dashboard

refs #6778
This commit is contained in:
Eric Lippmann 2015-05-21 10:19:07 +02:00
parent 1e9337846a
commit 970d4d7a4a

View File

@ -202,6 +202,9 @@ class DateFormatter
public static function timeUntil($time, $timeOnly = false) public static function timeUntil($time, $timeOnly = false)
{ {
list($type, $until, $invert) = static::diff($time); list($type, $until, $invert) = static::diff($time);
if ($invert) {
$until = '-' . $until;
}
if ($timeOnly) { if ($timeOnly) {
return $until; return $until;
} }
@ -217,7 +220,7 @@ class DateFormatter
case static::RELATIVE: case static::RELATIVE:
$formatted = sprintf( $formatted = sprintf(
t('in %s', 'An event will happen after the given time interval has elapsed'), t('in %s', 'An event will happen after the given time interval has elapsed'),
$invert ? ('-' . $until) : $until $until
); );
break; break;
case static::TIME: case static::TIME: