Skip to content

[Issues] Move FormatTime out of table package to a shared utility module #23

@felipeospina21

Description

@felipeospina21

Description

FormatTime (and possibly FormatDuration, FormatPercentage) currently live in table/utils.go, but they are general-purpose formatting helpers not specific to the table widget. Consumers like jiraf's details panel now import tuishell/table solely to use FormatTime for rendering comment timestamps, which creates a misleading dependency.

Additionally, mrglab has a timeAgo helper in internal/tui/components/details/render.go that appends " ago" to a time string. This should also be consolidated into the shared utility module so both consumers use the same formatting logic.

Tasks

  1. Create a new top-level package in tuishell (e.g. format/) for general-purpose formatting helpers
  2. Move FormatTime, FormatDuration, and FormatPercentage from table/utils.go to the new package
  3. Keep re-exports in table/ for backward compatibility (or update all call sites)
  4. Move mrglab's timeAgo (internal/tui/components/details/render.go) to use the shared helper
  5. Update jiraf's details panel to import from the new package instead of tuishell/table

Source

  • Roadmap section: Issues
  • Priority: low
  • Module: tuishell

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions