← Back to PRs

#7488: Handle future timestamps in relative time

by lawyered0 open 2026-02-02 21:54 View on GitHub →
## Summary\n- handle future timestamps in formatRelativeTime (in Xm / in Xh / Tomorrow / in Xd)\n- add vitest coverage for past & future cases\n\n## Testing\n- pnpm vitest run src/utils/time-format.test.ts\n <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR updates `formatRelativeTime` (`src/utils/time-format.ts`) to handle future timestamps by returning phrases like `in Xm`, `in Xh`, `Tomorrow`, and `in Xd`, falling back to a locale date string for longer ranges. It also adds Vitest coverage for both past and future cases (`src/utils/time-format.test.ts`). This function is used in the TUI session list (e.g., `src/tui/tui-command-handlers.ts:152`), so these new strings will show up in session descriptions when timestamps are in the future. <h3>Confidence Score: 4/5</h3> - This PR is reasonably safe to merge; changes are localized and covered by unit tests. - The implementation is straightforward and tests cover representative past/future outputs. Main remaining concern is the rounding behavior for future times near unit boundaries (hours/days), which could produce slightly surprising strings but won’t crash or corrupt state. - src/utils/time-format.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs