From 21802eede4e6709f825a085ac1846d639143bbb9 Mon Sep 17 00:00:00 2001
From: Graham McIntire
Date: Sun, 25 Jan 2026 14:52:13 -0600
Subject: [PATCH] adjust timestamps to be relative
---
.../live/agent_live/index.html.heex | 4 ++--
.../live/agent_live/show.html.heex | 20 ++++++-------------
.../live/dashboard_live.html.heex | 8 +++++---
.../live/device_live/index.html.heex | 16 +++++++++------
4 files changed, 23 insertions(+), 25 deletions(-)
diff --git a/lib/towerops_web/live/agent_live/index.html.heex b/lib/towerops_web/live/agent_live/index.html.heex
index 44d5daf2..43fd34f5 100644
--- a/lib/towerops_web/live/agent_live/index.html.heex
+++ b/lib/towerops_web/live/agent_live/index.html.heex
@@ -113,7 +113,7 @@
<%= if agent.last_seen_at do %>
- {format_datetime(agent.last_seen_at, @timezone)}
+ <.timestamp datetime={agent.last_seen_at} timezone={@timezone} />
<% end %>
<%= if agent.last_ip do %>
@@ -205,7 +205,7 @@
<%= if agent.last_seen_at do %>
- {format_datetime(agent.last_seen_at, @timezone)}
+ <.timestamp datetime={agent.last_seen_at} timezone={@timezone} />
<% end %>
<%= if agent.last_ip do %>
diff --git a/lib/towerops_web/live/agent_live/show.html.heex b/lib/towerops_web/live/agent_live/show.html.heex
index 93266395..d4d809f1 100644
--- a/lib/towerops_web/live/agent_live/show.html.heex
+++ b/lib/towerops_web/live/agent_live/show.html.heex
@@ -72,7 +72,10 @@
<%= if @agent_token.last_seen_at do %>
- {format_datetime(@agent_token.last_seen_at, @timezone)}
+ <.timestamp
+ datetime={@agent_token.last_seen_at}
+ timezone={@timezone}
+ />
<% end %>
<%= if @agent_token.last_ip do %>
@@ -141,19 +144,13 @@
Created
- {format_datetime(@agent_token.inserted_at, @timezone)}
-
-
- <.timestamp datetime={@agent_token.inserted_at} timezone={@timezone} /> (created)
+ <.timestamp datetime={@agent_token.inserted_at} timezone={@timezone} />
Last Updated
- {format_datetime(@agent_token.updated_at, @timezone)}
-
-
<.timestamp datetime={@agent_token.updated_at} timezone={@timezone} />
@@ -163,13 +160,8 @@
Last Seen (Heartbeat)
- {format_datetime(@agent_token.last_seen_at, @timezone)}
+ <.timestamp datetime={@agent_token.last_seen_at} timezone={@timezone} />
- <%= if @agent_token.last_seen_at do %>
-
- <.timestamp datetime={@agent_token.last_seen_at} timezone={@timezone} />
-
- <% end %>
<%= if @agent_token.last_ip do %>
diff --git a/lib/towerops_web/live/dashboard_live.html.heex b/lib/towerops_web/live/dashboard_live.html.heex
index 1c47203e..89f8e291 100644
--- a/lib/towerops_web/live/dashboard_live.html.heex
+++ b/lib/towerops_web/live/dashboard_live.html.heex
@@ -163,9 +163,11 @@
{alert.message}
-
- {ToweropsWeb.TimeHelpers.format_datetime(alert.triggered_at, @timezone)}
-
+ <.timestamp
+ datetime={alert.triggered_at}
+ timezone={@timezone}
+ class="text-xs text-gray-500 dark:text-gray-400 whitespace-nowrap"
+ />
<% end %>
diff --git a/lib/towerops_web/live/device_live/index.html.heex b/lib/towerops_web/live/device_live/index.html.heex
index bc8b874c..793aa122 100644
--- a/lib/towerops_web/live/device_live/index.html.heex
+++ b/lib/towerops_web/live/device_live/index.html.heex
@@ -143,9 +143,11 @@
<:col :let={eq} label="Last Checked">
-
- {ToweropsWeb.TimeHelpers.format_datetime(eq.last_checked_at, @timezone)}
-
+ <.timestamp
+ datetime={eq.last_checked_at}
+ timezone={@timezone}
+ class="text-sm text-gray-600 dark:text-gray-400"
+ />
<% end %>
@@ -249,9 +251,11 @@
<:col :let={discovered} label="Last Seen">
-
- {ToweropsWeb.TimeHelpers.format_datetime(discovered.last_seen, @timezone)}
-
+ <.timestamp
+ datetime={discovered.last_seen}
+ timezone={@timezone}
+ class="text-sm text-gray-600 dark:text-gray-400"
+ />
<:col :let={discovered} label="Actions">