fix: default dates to now
This commit is contained in:
@@ -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,
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user