From 6f50a96c5bc480de3e5698a7b48c45c69867b7f1 Mon Sep 17 00:00:00 2001 From: Faizan Date: Fri, 22 May 2026 22:40:29 +0200 Subject: [PATCH] feat: show "N seconds/minutes ago (at HH:MM)" for items copied within the last hour For clips recorded within the last 3600s, format_date now returns a relative label paired with the wall-clock time, e.g. "25 seconds ago (at 22:38)" or "15 minutes ago (at 20:24)". Older items keep the existing Today/Yesterday/date formats. --- clipse_gui/utils.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/clipse_gui/utils.py b/clipse_gui/utils.py index 13c5cf8..873b87e 100644 --- a/clipse_gui/utils.py +++ b/clipse_gui/utils.py @@ -25,6 +25,17 @@ def format_date(date_str): yesterday = today - timedelta(days=1) dt_date = dt.date() # Compare dates only + delta_seconds = (now - dt).total_seconds() + if 0 <= delta_seconds < 3600: + clock = dt.strftime("%H:%M") + if delta_seconds < 5: + return f"just now (at {clock})" + if delta_seconds < 60: + return f"{int(delta_seconds)} seconds ago (at {clock})" + minutes = int(delta_seconds // 60) + unit = "minute" if minutes == 1 else "minutes" + return f"{minutes} {unit} ago (at {clock})" + if dt_date == today: return f"Today at {dt.strftime('%H:%M')}" elif dt_date == yesterday: