Format::seconds(): handle negative values as expected

refs #3589
This commit is contained in:
Alexander A. Klimov 2019-01-17 16:40:27 +01:00
parent 08c879249b
commit c04b2594a6

View File

@ -54,11 +54,13 @@ class Format
public static function seconds($value)
{
if ($value < 60) {
$absValue = abs($value);
if ($absValue < 60) {
return self::formatForUnits($value, self::$secondPrefix, self::$secondBase);
} elseif ($value < 3600) {
} elseif ($absValue < 3600) {
return sprintf('%0.2f m', $value / 60);
} elseif ($value < 86400) {
} elseif ($absValue < 86400) {
return sprintf('%0.2f h', $value / 3600);
}