We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8984685 commit ab433e5Copy full SHA for ab433e5
1 file changed
src/libs/format-duration.ts
@@ -1,10 +1,15 @@
1
function formatDuration(ms: number) {
2
const totalSeconds = Math.floor(ms / 1000);
3
+
4
const h = Math.floor(totalSeconds / 3600);
5
const m = Math.floor((totalSeconds % 3600) / 60);
6
const s = totalSeconds % 60;
7
- return `${h}j ${m}m ${s}d`;
8
+ const hh = String(h).padStart(2, '0');
9
+ const mm = String(m).padStart(2, '0');
10
+ const ss = String(s).padStart(2, '0');
11
12
+ return `${hh}j ${mm}m ${ss}d`;
13
}
14
15
export { formatDuration };
0 commit comments