diff --git a/lib/towerops_web/components/core_components.ex b/lib/towerops_web/components/core_components.ex index 388e2ad4..818b8574 100644 --- a/lib/towerops_web/components/core_components.ex +++ b/lib/towerops_web/components/core_components.ex @@ -776,6 +776,7 @@ defmodule ToweropsWeb.CoreComponents do attr :datetime, :any, required: true, doc: "DateTime to display" attr :timezone, :string, default: "UTC", doc: "User's timezone for full timestamp" attr :class, :string, default: "", doc: "Additional CSS classes" + attr :format, :string, default: "relative", doc: "Display format: 'relative' or 'absolute'" def timestamp(assigns) do assigns = @@ -784,8 +785,8 @@ defmodule ToweropsWeb.CoreComponents do |> assign(:full_time, ToweropsWeb.TimeHelpers.format_datetime(assigns.datetime, assigns.timezone)) ~H""" - - {@relative_time} + + {if @format == "relative", do: @relative_time, else: @full_time} """ end diff --git a/lib/towerops_web/live/agent_live/index.html.heex b/lib/towerops_web/live/agent_live/index.html.heex index d5c49527..a898c583 100644 --- a/lib/towerops_web/live/agent_live/index.html.heex +++ b/lib/towerops_web/live/agent_live/index.html.heex @@ -116,7 +116,7 @@ <%= if agent.last_seen_at do %>
- {format_datetime(agent.last_seen_at, @timezone)} + <.timestamp datetime={agent.last_seen_at} timezone={@timezone} format="absolute" />
<% end %> <%= if agent.last_ip do %> @@ -227,7 +227,7 @@ <%= if agent.last_seen_at do %>
- {format_datetime(agent.last_seen_at, @timezone)} + <.timestamp datetime={agent.last_seen_at} timezone={@timezone} format="absolute" />
<% 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 a47352cf..cedeb554 100644 --- a/lib/towerops_web/live/agent_live/show.html.heex +++ b/lib/towerops_web/live/agent_live/show.html.heex @@ -171,7 +171,11 @@

<%= if @agent_token.last_seen_at do %>

- {format_datetime(@agent_token.last_seen_at, @timezone)} + <.timestamp + datetime={@agent_token.last_seen_at} + timezone={@timezone} + format="absolute" + />

<% end %> <%= if @agent_token.last_ip do %>