opencode
opencode copied to clipboard
feat(tui): add 24-hour time format option for session view
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)
After (24-hour format)
Changes
- Added
time_formatconfiguration 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