fix: undo "just now"

This commit is contained in:
2026-03-24 15:58:03 +04:00
parent 313c9973cd
commit 7f6f79f028
2 changed files with 1 additions and 2 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ const eta = new Eta({ views: resolve(import.meta.dir, "../views"), cache: true,
function timeAgoSSR(date: string | Date): string {
const ts = new Date(date).getTime();
const s = Math.max(0, Math.floor((Date.now() - ts) / 1000));
const text = s < 2 ? 'just now' : s < 60 ? `${s}s ago` : s < 3600 ? `${Math.floor(s/60)}m ago` : s < 86400 ? `${Math.floor(s/3600)}h ago` : `${Math.floor(s/86400)}d ago`;
const text = s < 60 ? `${s}s ago` : s < 3600 ? `${Math.floor(s/60)}m ago` : s < 86400 ? `${Math.floor(s/3600)}h ago` : `${Math.floor(s/86400)}d ago`;
return `<span class="timestamp" data-ts="${ts}">${text}</span>`;
}