Skip to content

Commit

Permalink
Merge pull request #3846 from ThyThal/8.x.x
Browse files Browse the repository at this point in the history
(Update) timeElapsed now returns used values only
  • Loading branch information
HDVinnie committed May 22, 2024
2 parents 57f7fb6 + fff090a commit 9612204
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/Helpers/StringHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ public static function timeElapsed(int $seconds): string

foreach (self::secondsPer as $unit => $secondsPer) {
$magnitude = intdiv($seconds, $secondsPer);
$seconds -= $magnitude * $secondsPer;
$units[$unit] = $magnitude.trans('common.abbrev-'.$unit.'s');

if ($magnitude > 0) {
$units[] = $magnitude.trans('common.abbrev-'.$unit.'s');
$seconds -= $magnitude * $secondsPer;
}
}

return implode($units);
Expand Down

0 comments on commit 9612204

Please sign in to comment.