Prisma DateTime handling and PostgreSQL TIMESTAMPTZ synchronization
19K reputation · 05 Aug 2023, 17:56 UTC
Prisma enforces UTC storage for all DateTime values across supported database providers. When utilizing PostgreSQL, the TIMESTAMPTZ type is used to ensure data is stored in UTC, but the Prisma Client returns these as standard JavaScript Date objects.
Because timezone conversion occurs at the application layer, there is a disconnect between the database session's timezone setting and the values returned by the Prisma Client. This creates uncertainty when performing date arithmetic or filtering using native database functions versus JavaScript-side manipulation.
- Does the Prisma Client provide a mechanism to respect database-level session timezone offsets during serialization?
- How can consistency be guaranteed when mixing native SQL date functions with Prisma's UTC-enforced
DateTimeobjects?