Skip to content

duration() shows wrong days and hours past 24h #32956

Description

@itsybitsybootsy

Description

duration() in packages/tui/src/util/locale.ts gets the days/hours branch wrong once a duration reaches 24h.

It computes days from the sub-hour remainder (input % 3600000) divided by a full day, which is always 0, and leaves hours as the uncapped total:

const hours = Math.floor(input / 3600000)               // total hours, never capped
const days  = Math.floor((input % 3600000) / 86400000)  // always 0

So:

  • 1 day → 0d 24h (expected 1d 0h)
  • 2d 3h → 0d 51h (expected 2d 3h)

It's used to show elapsed time in the TUI session view, where a span is completed - created over a whole session or subagent, so anything that ran 24h or longer shows a nonsensical value.

OpenCode version

dev (1.17.8)

Steps to reproduce

duration(86400000)   // "0d 24h", expected "1d 0h"
duration(183600000)  // "0d 51h", expected "2d 3h"

Activity

added a commit that references this issue on Jun 22, 2026
829ea1e
added a commit that references this issue on Jun 27, 2026
1c9fb58
added a commit that references this issue on Jun 29, 2026
2602aff
added a commit that references this issue on Jul 6, 2026
431f746
added a commit that references this issue on Jul 9, 2026
e3cb8f7
added a commit that references this issue on Jul 31, 2026
8ad4848
added a commit that references this issue on Sep 24, 2026
4dbd289
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions