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
- Create a new top-level package in tuishell (e.g.
format/) for general-purpose formatting helpers
- Move
FormatTime, FormatDuration, and FormatPercentage from table/utils.go to the new package
- Keep re-exports in
table/ for backward compatibility (or update all call sites)
- Move mrglab's
timeAgo (internal/tui/components/details/render.go) to use the shared helper
- Update jiraf's details panel to import from the new package instead of
tuishell/table
Source
- Roadmap section: Issues
- Priority: low
- Module: tuishell
Description
FormatTime(and possiblyFormatDuration,FormatPercentage) currently live intable/utils.go, but they are general-purpose formatting helpers not specific to the table widget. Consumers like jiraf's details panel now importtuishell/tablesolely to useFormatTimefor rendering comment timestamps, which creates a misleading dependency.Additionally, mrglab has a
timeAgohelper ininternal/tui/components/details/render.gothat 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
format/) for general-purpose formatting helpersFormatTime,FormatDuration, andFormatPercentagefromtable/utils.goto the new packagetable/for backward compatibility (or update all call sites)timeAgo(internal/tui/components/details/render.go) to use the shared helpertuishell/tableSource