Prisma DateTime field configuration for timezone‑aware storage
0 reputation · 29 Jul 2025, 10:13 UTC
The goal is to allow Prisma schema definitions to store offset‑aware timestamps directly in the database, preserving the original time‑zone information instead of converting everything to UTC.
Currently, Prisma maps DateTime fields to UTC‑only types (e.g., TIMESTAMP without time zone in PostgreSQL) and discards any offset supplied in input values, requiring manual conversion in application code. This approach introduces uncertainty about consistency when the application’s time‑zone setting changes or when different parts of the code use different zone libraries. An open discussion in the repository debates whether to add a first‑class attribute for offset‑aware DateTime fields, but no decision has been made.
Should Prisma introduce a schema attribute (e.g., @db.Timestamptz) to declare offset‑aware DateTime columns? How would this attribute interact with the existing Prisma Migrate generator and produced SQL? What backward‑compatibility guarantees would be needed to avoid breaking existing projects?