mirror of
https://github.com/Roslund/sthlm-mesh.git
synced 2026-03-28 17:43:02 +01:00
17 lines
529 B
JavaScript
17 lines
529 B
JavaScript
function countNodesSince(daysAgo) {
|
|
const now = new Date();
|
|
const threshold = new Date(now);
|
|
threshold.setDate(threshold.getDate() - daysAgo);
|
|
return nodes.filter(node => new Date(node.updated_at) >= threshold).length;
|
|
}
|
|
|
|
async function nodesSeen() {
|
|
await fetchNodes();
|
|
|
|
document.getElementById("count-30").textContent = countNodesSince(30);
|
|
document.getElementById("count-7").textContent = countNodesSince(7);
|
|
document.getElementById("count-1").textContent = countNodesSince(1);
|
|
}
|
|
|
|
nodesSeen();
|