diff --git a/packages/protolib/src/bundles/agents/agents/agentsPage.tsx b/packages/protolib/src/bundles/agents/agents/agentsPage.tsx index e70279ffd..68c15b426 100644 --- a/packages/protolib/src/bundles/agents/agents/agentsPage.tsx +++ b/packages/protolib/src/bundles/agents/agents/agentsPage.tsx @@ -96,6 +96,21 @@ const AgentCard = ({ data, extraMenuActions }) => { return response.data } + function formatTimestamp(timestamp) { + if (timestamp === null) return "never connected" + const date = new Date(timestamp); + + const hours = date.getHours().toString().padStart(2, '0'); + const minutes = date.getMinutes().toString().padStart(2, '0'); + + const day = date.getDate().toString().padStart(2, '0'); + const month = (date.getMonth() + 1).toString().padStart(2, '0'); + const year = date.getFullYear(); + + return `${hours}:${minutes} ${day}/${month}/${year}`; + } + + useEffect(() => { const interval = setInterval(async () => { const statusResult = await getAgentStatus(data.name) @@ -114,6 +129,7 @@ const AgentCard = ({ data, extraMenuActions }) => { {status.online ? 'online' : 'offline'} + {formatTimestamp(status.last_view)} {