Update stat.js to use new meta database format

This commit is contained in:
Fred Boniface 2023-02-12 21:40:38 +00:00
parent a3fdda62d4
commit c7b2813a3c
2 changed files with 7 additions and 1 deletions

View File

@ -129,4 +129,10 @@ async function vibe(type) {
default: default:
navigator.vibrate(30) navigator.vibrate(30)
} }
}
async function convertUnixLocal(unix) {
var jsTime = unix*1000
var dt = new Date(jsTime)
return dt.toLocaleString()
} }

View File

@ -14,7 +14,7 @@ async function display(data) {
document.getElementById('server_host').textContent = `HOST: ${data.host}`; document.getElementById('server_host').textContent = `HOST: ${data.host}`;
let dat = data.dat[0] let dat = data.dat[0]
console.log(JSON.stringify(dat)) 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('ldbws').textContent = dat.ldbws || "0";
document.getElementById('ldbsvws').textContent = dat.ldbsvws || "0"; document.getElementById('ldbsvws').textContent = dat.ldbsvws || "0";
document.getElementById('corpus').textContent = dat.corpus || "0"; document.getElementById('corpus').textContent = dat.corpus || "0";