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) => {
|
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,
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user