From 4f0601cff75c0b3b1dae4f969b5bdb55306a7d03 Mon Sep 17 00:00:00 2001 From: Yasen Pramatarov Date: Wed, 2 Oct 2024 22:50:27 +0300 Subject: [PATCH] Fixes timestamps in cache --- public_html/static/agents.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public_html/static/agents.js b/public_html/static/agents.js index f05856e..3e8730f 100644 --- a/public_html/static/agents.js +++ b/public_html/static/agents.js @@ -57,7 +57,8 @@ function fetchData(agent_id, url, endpoint, jwtToken, force = false) { resultElement.innerHTML = JSON.stringify(result, null, 2); // Show the cache timestamp from the session - const cacheTimestamp = new Date(result.cache_time); + const now = Date.now(); + const cacheTimestamp = new Date(now); // Display the cache retrieval date and time const formattedDate = cacheTimestamp.toLocaleDateString(); @@ -135,7 +136,7 @@ function loadCache(agent_id) { resultElement.innerHTML = JSON.stringify(response.data, null, 2); // Get the cache timestamp from the session - const cacheTimestamp = new Date(response.cache_time); + const cacheTimestamp = new Date(response.cache_time * 1000); // Display the cache retrieval date and time const formattedDate = cacheTimestamp.toLocaleDateString();