Refactor minutesToHm method in Staff Playtime component for improved readability by adding explicit braces to conditional blocks.
This commit is contained in:
parent
06a1cd64e3
commit
39b7a398a5
|
|
@ -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(' ');
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user