track create and edit separately

This commit is contained in:
schmeeve
2026-09-23 19:21:31 -07:00
parent 7788c10fde
commit caf8187252

View File

@@ -409,7 +409,7 @@ function noteList(notes) {
const isCommon = n.username === state.commonSpace;
const meta = el("div", { class: "note-meta" });
if (isCommon) meta.appendChild(el("span", { class: "common-badge", text: "common" }));
meta.appendChild(document.createTextNode(`${n.username} · ${relTime(n.updated_at)}`));
meta.appendChild(document.createTextNode(`${n.username} · edited ${relTime(n.updated_at)} · created ${fmtDate(n.created_at)}`));
if (n.attachments) meta.appendChild(el("span", { class: "attach-count", text: n.attachments + " attachment" + (n.attachments === 1 ? "" : "s") }));
const bodyEl = el("div", { class: "note-body" }, [
el("div", { class: "note-title", text: n.title || "Untitled" }),
@@ -443,6 +443,13 @@ async function searchFor(q) {
box.appendChild(noteList(results));
}
function fmtDate(iso) {
if (!iso) return "";
const d = new Date(iso.replace(" ", "T") + "Z");
if (isNaN(d)) return iso;
return d.toLocaleDateString();
}
function relTime(iso) {
if (!iso) return "";
const d = new Date(iso.replace(" ", "T") + "Z");