Skip to content

Commit 829ea1e

Browse files
Robin1987Chinachineseboy
authored andcommitted
fix(tui): correct duration() days/hours calculation past 24h
Days was always 0 (computed from sub-hour remainder divided by a full day) and hours was the uncapped total. Compute days from total ms and hours from the remainder after removing whole days. Closes anomalyco#32956
1 parent f04f794 commit 829ea1e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎packages/tui/src/util/locale.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ export function duration(input: number) {
5353
const minutes = Math.floor((input % 3600000) / 60000)
5454
return `${hours}h ${minutes}m`
5555
}
56-
const hours = Math.floor(input / 3600000)
57-
const days = Math.floor((input % 3600000) / 86400000)
56+
const days = Math.floor(input / 86400000)
57+
const hours = Math.floor((input % 86400000) / 3600000)
5858
return `${days}d ${hours}h`
5959
}
6060

0 commit comments

Comments
 (0)