Improve day swipe and sleep handling
This commit is contained in:
@@ -115,6 +115,23 @@ function format_points(float $value): string
|
||||
return number_format($rounded, 1, ',', '.');
|
||||
}
|
||||
|
||||
function format_duration_hours(float $hours): string
|
||||
{
|
||||
$minutes = max(0, (int) round($hours * 60));
|
||||
$wholeHours = intdiv($minutes, 60);
|
||||
$remainingMinutes = $minutes % 60;
|
||||
|
||||
if ($wholeHours <= 0) {
|
||||
return $remainingMinutes . ' min';
|
||||
}
|
||||
|
||||
if ($remainingMinutes === 0) {
|
||||
return $wholeHours . ' h';
|
||||
}
|
||||
|
||||
return $wholeHours . ' h ' . $remainingMinutes . ' min';
|
||||
}
|
||||
|
||||
function normalize_username(string $username): string
|
||||
{
|
||||
return strtolower(trim($username));
|
||||
|
||||
Reference in New Issue
Block a user