Alve
Alve
DTDrizzle Team
Created by Alve on 2/11/2025 in #help
Updating a date with the node-postgres adapter
I am trying to update a date value like this:
await db
.update(schema.order)
.set({ completedDate: new Date() }) // same error with sql`now()`
.where(eq(schema.order.id, order.id));
await db
.update(schema.order)
.set({ completedDate: new Date() }) // same error with sql`now()`
.where(eq(schema.order.id, order.id));
But I get an error value.toISOString is not a function, and searching that up, I came across this: https://github.com/drizzle-team/drizzle-orm/issues/2388 In the schema it is defined like this: completedDate: timestamp({ withTimezone: true }), I am not really sure how to solve it, I'd prefer to solve it without using type: 'string', because there's other code depending on it being a Date object returned.. Am I doing something wrong or is it just broken?
12 replies