From a30c1ce43ec61d46f707cd2f8534b240bc8e43b6 Mon Sep 17 00:00:00 2001 From: Julien Calixte Date: Fri, 13 Feb 2026 20:26:15 +0100 Subject: [PATCH] fix: default dates to now --- src/data/db.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/data/db.ts b/src/data/db.ts index fc151b5..1d2ffb2 100644 --- a/src/data/db.ts +++ b/src/data/db.ts @@ -58,6 +58,7 @@ export const deleteNote = ({ did, rkey }: { did: string; rkey: string }) => { }; export const upsertNote = (note: Note) => { + const now = new Date().toISOString() db.query( ` INSERT INTO note ( @@ -75,8 +76,8 @@ export const upsertNote = (note: Note) => { `, [ note.title, - new Date(note.publishedAt).toISOString(), // publishedAt - new Date(note.createdAt).toISOString(), // createdAt + note.publishedAt ? new Date(note.publishedAt).toISOString() : now, + note.createdAt ? new Date(note.createdAt).toISOString() : now, note.did, note.rkey, ],