Skip to content

Commit 6495fb7

Browse files
committed
fix duration calculation to handle more precise values
1 parent 1c3ec80 commit 6495fb7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/helpers/duration.helpers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export function importDuration(value: string) {
44
.split(":")
55
.reverse()
66
.map((e) => Number(e));
7-
return (seconds ?? 0) + (minutes ?? 0) * 60 + (hours ?? 0) * 3600 + (milliseconds ? Number(milliseconds.padEnd(3, "0") ?? 0) / 1000 : 0);
7+
return (seconds ?? 0) + (minutes ?? 0) * 60 + (hours ?? 0) * 3600 + (milliseconds ? Number(milliseconds.padEnd(milliseconds.length, "0") ?? 0) / Number("1".padEnd(milliseconds.length + 1, "0")) : 0);
88
}
99

1010
export function formatDuration(x: number, precision = 0) {

0 commit comments

Comments
 (0)