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) => {
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,
],