Issue with filtering on timestamp column

I have a postgres database, using pg-core. A table has a row defined as: expirationDate: timestamp("expiration_date", { mode: "date" }).notNull() I am attempting to write a query to delete records that have an expirationDate in the past with this:
const deletedUserIds: { deletedId: string }[] = await db
.delete(TokensTable)
.where(lt(TokensTable.expirationDate, Date.now()))
.returning({ deletedId: TokensTable.user });
const deletedUserIds: { deletedId: string }[] = await db
.delete(TokensTable)
.where(lt(TokensTable.expirationDate, Date.now()))
.returning({ deletedId: TokensTable.user });
I am getting an error on the lt function, specifically: "No overload matches this call."
2 Replies
TH
TH2mo ago
(I'm running typescript)
rphlmr ⚡
rphlmr ⚡2mo ago
Hello, Date.now() returns a number and expirationDate is a Date. You could try new Date()