Refactor minutesToHm method in Staff Playtime component for improved readability by adding explicit braces to conditional blocks.

This commit is contained in:
akastijn 2025-11-02 22:58:47 +01:00
parent 06a1cd64e3
commit 39b7a398a5

View File

@ -74,9 +74,15 @@ export class StaffPtComponent implements OnInit {
const h = Math.floor((mins % 1440) / 60);
const m = mins % 60;
const parts = [];
if (d > 0) parts.push(`${d}d`);
if (h > 0 || d > 0) parts.push(`${h}h`);
if (m > 0 || (h === 0 && d === 0)) parts.push(`${m}m`);
if (d > 0) {
parts.push(`${d}d`);
}
if (h > 0 || d > 0) {
parts.push(`${h}h`);
}
if (m > 0 || (h === 0 && d === 0)) {
parts.push(`${m}m`);
}
return parts.join(' ');
}