more QOL improvements
Build Images and Deploy / Update-PROD-Stack (push) Successful in 29s

This commit is contained in:
2026-02-28 01:37:32 -05:00
parent b9981d0e70
commit 4f9e92bda7
18 changed files with 426 additions and 32 deletions
+31
View File
@@ -0,0 +1,31 @@
// Relative timestamp ("time ago") for <time> elements
(function () {
function timeAgo(date) {
const now = new Date();
const seconds = Math.floor((now - date) / 1000);
if (seconds < 5) return 'just now';
if (seconds < 60) return seconds + 's ago';
const minutes = Math.floor(seconds / 60);
if (minutes < 60) return minutes + 'm ago';
const hours = Math.floor(minutes / 60);
if (hours < 24) return hours + 'h ago';
const days = Math.floor(hours / 24);
if (days < 7) return days + 'd ago';
if (days < 30) return Math.floor(days / 7) + 'w ago';
if (days < 365) return Math.floor(days / 30) + 'mo ago';
return Math.floor(days / 365) + 'y ago';
}
function updateTimes() {
document.querySelectorAll('time[datetime]').forEach(function (el) {
var d = new Date(el.getAttribute('datetime'));
if (!isNaN(d)) {
el.textContent = timeAgo(d);
el.title = d.toLocaleString();
}
});
}
updateTimes();
setInterval(updateTimes, 30000); // refresh every 30s
})();