From c7b2813a3ceab786012d53b545549cbd5a82e304 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sun, 12 Feb 2023 21:40:38 +0000 Subject: [PATCH] Update stat.js to use new meta database format --- js/lib.main.js | 6 ++++++ js/stat.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/js/lib.main.js b/js/lib.main.js index 5968c47..b22837c 100644 --- a/js/lib.main.js +++ b/js/lib.main.js @@ -129,4 +129,10 @@ async function vibe(type) { default: navigator.vibrate(30) } +} + +async function convertUnixLocal(unix) { + var jsTime = unix*1000 + var dt = new Date(jsTime) + return dt.toLocaleString() } \ No newline at end of file diff --git a/js/stat.js b/js/stat.js index 254ef18..6ba4756 100644 --- a/js/stat.js +++ b/js/stat.js @@ -14,7 +14,7 @@ async function display(data) { document.getElementById('server_host').textContent = `HOST: ${data.host}`; let dat = data.dat[0] console.log(JSON.stringify(dat)) - document.getElementById('time').textContent = dat.since; + document.getElementById('time').textContent = convertUnixLocal(dat.since); document.getElementById('ldbws').textContent = dat.ldbws || "0"; document.getElementById('ldbsvws').textContent = dat.ldbsvws || "0"; document.getElementById('corpus').textContent = dat.corpus || "0";