Correct setting for PostgreSQL timestamp storing UTC value

Hey all, I've read the following but want to check - is the ..defaultNow() method going to return localised now or UTC? https://orm.drizzle.team/docs/guides/timestamp-default-value#postgresql
Drizzle ORM - SQL Timestamp as a default value
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
1 Reply
je823
je823OP2w ago
timestamp().defaultNow() is fine. https://github.com/drizzle-team/drizzle-orm/blob/main/drizzle-orm/src/pg-core/columns/date.common.ts - resolves to now() postgres function. If creating a timestamp field withoutTimezone, then now() returns a UTC default value
GitHub
drizzle-orm/drizzle-orm/src/pg-core/columns/date.common.ts at main ...
Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅 - drizzle-team/drizzle-orm

Did you find this page helpful?