Skip to content

bug: TSQL numeric duration formatting drops the sign for negative values #5169

Backlog

Description

@raunakpandey1

Provide environment information

macOS arm64, Node 22, Trigger.dev source 33b83c6, Vitest 4.1.12, humanize-duration 3.27.3 from the repo lockfile.

Describe the bug

The dashboard uses formatDurationMilliseconds for numeric duration cells returned by TSQL. A duration delta can be negative. The helper removes the sign and picks millisecond units even when the absolute duration exceeds a second, so a negative delta can be displayed as a positive value.

Reproduction repo

Focused formatter tests on my fork.

To reproduce

On current main at 33b83c6, call formatDurationMilliseconds(-1500, { style: "short" }) from the core duration module. The result is 1500ms; the same positive input gives 1.5s. formatDurationMilliseconds(-500, { style: "short" }) similarly returns 500ms. The nanosecond wrapper inherits the behavior.

Suggested fix

Use magnitude to choose units, then prepend the original sign. Preserve positive and zero formatting and the existing absolute-distance behavior of the date-to-date helper.

Additional information

Reproduced using the source helper and the locked formatter dependency. Three negative cases failed on main. Six cases, including positive and zero controls, passed after the proposed change. Codex assisted with investigation and local testing.

Activity

  1. CycloSolutions commented on Dec 1, 2026

    @CycloSolutions

    Cyclo is working on this issue. We will submit the implementation with verification evidence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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