How can I make my Postgres schema automatically insert `UTC` time when using `defaultNow()`?

The example below is inserting the time using the timezone of my computer instead of UTC.
createdAt: timestamp('created_at').defaultNow(),
createdAt: timestamp('created_at').defaultNow(),
3 Replies
imoby
imoby11mo ago
check the timezone of your postgres database make sure its set to utc
Vinny
VinnyOP11mo ago
It's already set to UTC, but when a record gets inserted it is not, Drizzle is using the time set on my computer.
No description
Dan Claroni
Dan Claroni11mo ago
try adding { mode: 'date', withTimezone: true } to the timestamp column config (second arg after column name) to set timezone
Want results from more Discord servers?
Add your server