Can't deserialize datetime string from Postgres
I'm getting the following error:
I can correctly read the value with
node-postgres and Jetbrains DataGrip. I tried to install Postgres 17 both with Homebrew and Postgres.app.
I've confirmed that the DateStyle setting is set to the default (ISO, MDY)
I'm using Prisma 6.53 Replies
You opted for speed from this bot. Let's conjure up an answer right now!
The error you're seeing:
indicates that Prisma is unable to parse the datetime string returned by Postgres because of its format, specifically the presence of the timezone offset (
-04). This is a known limitation: Prisma expects datetime strings in strict ISO 8601 format (e.g., 2025-05-22T13:03:05.144Z), and does not currently support deserializing strings with timezone offsets like -04 or formats like 2025-05-22 13:03:05.144-04 directly from the database. This issue has been reported by other users as well, especially when using columns with types like TIMESTAMPTZ or TIMESTAMP WITH TIME ZONE in PostgreSQL, and Prisma throws a conversion error when the format doesn't match its expectations DateTime doesn't support ISO string with offset, PostgreSQL data type datetimetz inserts and updates fail via Prisma.
Other tools like node-postgres and DataGrip are more flexible in parsing these formats, but Prisma's parser is strict. There is currently no configuration in Prisma to change this behavior or to automatically handle these timezone offsets.
Workarounds:
- Ensure that your database returns datetime values in ISO 8601 format with a Z (UTC), or use JavaScript Date objects when writing data.
- If you control the data insertion, convert dates to ISO strings (.toISOString()) before saving.
- If you need to read legacy data, you may need to transform the data format outside of Prisma before processing.
Unfortunately, as of Prisma 6.5, this limitation still exists and there is no built-in fix. You may want to follow or comment on the related GitHub issues for updates on this feature DateTime doesn't support ISO string with offset, PostgreSQL data type datetimetz
inserts and updates fail via Prisma.It's weird though, because I've only noticed this issue on one colleague's Mac machine. I'm on Ubuntu, have some other colleagues on Mac, but it's the first time I see this.
Hmm, strange.
Would it be possible to provide a minimal reproduction so that we can investigate?