bun
bun
Explore posts from servers
DTDrizzle Team
Created by bun on 4/1/2024 in #help
dates in sqlite not being evaluated, causing "Invalid Date"
expiresAt: int("expires_at", { mode: "timestamp" })
.notNull()
.$defaultFn(() => new Date(Date.now() + 1000 * 60 * 60 * 24 * 365)),
createdAt: int("created_at", { mode: "timestamp" })
.notNull()
.default(sql`CURRENT_TIMESTAMP`),

expiresAt: int("expires_at", { mode: "timestamp" })
.notNull()
.$defaultFn(() => new Date(Date.now() + 1000 * 60 * 60 * 24 * 365)),
createdAt: int("created_at", { mode: "timestamp" })
.notNull()
.default(sql`CURRENT_TIMESTAMP`),

I have the following columns in my sqlite table, for some reason the expiresAt column works fine, when being read, its being evaluated as an actual date, and is saved in the database as an UNIX timestamp, however, the createdAt column is being saved as an actual ISO string date, but upon quering it shows INVALID DATE, why is it?
4 replies