From f9f7ae6ad35292d7f201a1b6a3a697c37528db2b Mon Sep 17 00:00:00 2001 From: shuki Date: Fri, 6 Mar 2026 16:42:41 +0200 Subject: [PATCH] Format snapshot timestamps as readable dates in snapshots browser Display '2026-03-06 14:07:06' instead of raw '2026-03-06T140706'. Co-Authored-By: Claude Opus 4.6 --- tui/screens/snapshots.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tui/screens/snapshots.py b/tui/screens/snapshots.py index 457d200..776ea74 100644 --- a/tui/screens/snapshots.py +++ b/tui/screens/snapshots.py @@ -1,4 +1,5 @@ import re +from datetime import datetime from textual.app import ComposeResult from textual.screen import Screen @@ -11,6 +12,15 @@ from tui.backend import run_cli from tui.widgets import SnapshotBrowser +def _format_snapshot_ts(ts: str) -> str: + """Format '2026-03-06T140706' as '2026-03-06 14:07:06'.""" + try: + dt = datetime.strptime(ts, "%Y-%m-%dT%H%M%S") + return dt.strftime("%Y-%m-%d %H:%M:%S") + except ValueError: + return ts + + class SnapshotsScreen(Screen): BINDINGS = [("escape", "go_back", "Back")] @@ -74,7 +84,7 @@ class SnapshotsScreen(Screen): lines = [l.strip() for l in stdout.splitlines() if l.strip() and not l.startswith("===")] if lines: for s in lines: - table.add_row(s, key=s) + table.add_row(_format_snapshot_ts(s), key=s) else: self.notify("No snapshots found", severity="warning") if stderr: