fix: default dates to now

This commit is contained in:
Julien Calixte
2026-02-13 20:26:15 +01:00
parent c44c2bac3f
commit a30c1ce43e

View File

@@ -58,6 +58,7 @@ export const deleteNote = ({ did, rkey }: { did: string; rkey: string }) => {
}; };
export const upsertNote = (note: Note) => { export const upsertNote = (note: Note) => {
const now = new Date().toISOString()
db.query( db.query(
` `
INSERT INTO note ( INSERT INTO note (
@@ -75,8 +76,8 @@ export const upsertNote = (note: Note) => {
`, `,
[ [
note.title, note.title,
new Date(note.publishedAt).toISOString(), // publishedAt note.publishedAt ? new Date(note.publishedAt).toISOString() : now,
new Date(note.createdAt).toISOString(), // createdAt note.createdAt ? new Date(note.createdAt).toISOString() : now,
note.did, note.did,
note.rkey, note.rkey,
], ],