diff --git a/diigo-cache/src/index.ts b/diigo-cache/src/index.ts
index ea09df1..224da4d 100644
--- a/diigo-cache/src/index.ts
+++ b/diigo-cache/src/index.ts
@@ -15,7 +15,7 @@
import { WorkerEntrypoint } from "cloudflare:workers";
import { DiigoCache, PublicCache } from "./cache.js";
import type { Item } from "./cache.js";
-import { usernameOf } from "./items.js";
+import { updatedISO, usernameOf } from "./items.js";
import { toWebkey, idFromWebkey, isWebkey, shashKey } from "./webkeys.js";
import { pmSave } from "./pm-save.js";
@@ -457,7 +457,9 @@ ${items
const title = typeof it.title === "string" && it.title ? it.title : url;
const desc = typeof it.description === "string" && it.description ? `
${esc(it.description)}` : "";
const href = /^https?:\/\//i.test(url) ? url : "#";
- return `
${esc(title)}${desc}`;
+ const when = updatedISO(it);
+ const date = when ? `` : "(no date)";
+ return `${date} ${esc(title)}${desc}`;
})
.join("\n")}
`;
diff --git a/diigo-cache/src/items.ts b/diigo-cache/src/items.ts
index c78cdcc..10dac1f 100644
--- a/diigo-cache/src/items.ts
+++ b/diigo-cache/src/items.ts
@@ -64,3 +64,11 @@ export function usernameOf(item: Item | undefined): string {
export function publicOnly(rows: ItemRow[]): ItemRow[] {
return rows.filter((r) => !r.private);
}
+
+/** when diigo last updated the item, as `Date#toISOString()`, or "" when
+ * it carries no usable `updated_at` (diigo sends epoch *seconds*) */
+export function updatedISO(item: Item): string {
+ const secs = item.updated_at;
+ if (typeof secs !== "number" || !Number.isFinite(secs)) return "";
+ return new Date(secs * 1000).toISOString();
+}
diff --git a/diigo-cache/tests/caches.test.ts b/diigo-cache/tests/caches.test.ts
index 55523d0..b406de6 100644
--- a/diigo-cache/tests/caches.test.ts
+++ b/diigo-cache/tests/caches.test.ts
@@ -117,6 +117,8 @@ describe("worker routes", () => {
const again = await (await call(`/public/${username}?page=2`)).text();
expect(again).toContain("cache: HIT");
expect(html).toContain("bookmark 25");
+ // the date comes first, in toISOString() form
+ expect(html).toMatch(/