Added function formatDuration to format times like worked etc, updated Time worked in Ticket details to use the new function and some other minor ui/ux cleanups in ticket details

This commit is contained in:
johnnyq
2026-01-28 16:08:39 -05:00
parent 704d770ec2
commit 0470159c55
2 changed files with 44 additions and 20 deletions

View File

@@ -1998,3 +1998,20 @@ function dbRollback(mysqli $mysqli): void
{
$mysqli->rollback();
}
function formatDuration($time) {
// expects "HH:MM:SS"
[$h, $m, $s] = array_map('intval', explode(':', $time));
$parts = [];
if ($h > 0) $parts[] = $h . 'h';
if ($m > 0) $parts[] = $m . 'm';
// show seconds only if under 1 minute total OR if nothing else exists
if ($h == 0 && $m == 0) {
$parts[] = $s . 's';
}
return implode(' ', $parts);
}