opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat(tui): add 24-hour time format option for session view

Open Octane0411 opened this issue 5 days ago • 3 comments

Description

Adds support for 24-hour time format in the TUI session view, addressing Issue #7208.

Users can now configure whether timestamps in the session view display in 12-hour (AM/PM) or 24-hour format.

Before & After

Before (12-hour format - default)

7bc66c04-e643-433e-bd20-f4b7f35de2e5

After (24-hour format)

52a1a39e-fc0e-4fc5-8a66-46cb8c9f9113

Changes

  • Added time_format configuration option to TUI settings (supports "12h" and "24h" formats)
  • Updated time formatting utilities (Locale.time, Locale.datetime, Locale.todayTimeOrDateTime) to accept format parameter
  • Applied time format configuration to:
    • Session list view
    • Fork from timeline dialog
    • Timeline view
  • Added unit tests for time formatting functions

Configuration Example

Add the following to your opencode.jsonc or .opencode/opencode.jsonc:

{
  "tui": {
    // Use 24-hour time format (default is 12-hour)
    "time_format": "24h"
  }
}

Or use 12-hour format explicitly:

{
  "tui": {
    "time_format": "12h"
  }
}

Testing

  • Session list displays correct time format based on configuration
  • Fork dialog shows correct time format
  • Timeline view respects time format setting
  • Unit tests pass for both 12h and 24h formats

Related Issue

Closes #7208

Octane0411 avatar Jan 07 '26 17:01 Octane0411