Bug description
Follow up to #26786 with some precisions,
it's not a retrieval issue, dates are not stored correctly in db if db timezone isn't set to UTC.
Kinda severe for a pushed up feature which is now the default with v7, and a clear regression.
That's why I create a new issue.
It's mitigated though as DBs are commonly set to UTC.
Issue:
Date object intended to be stored in a Timestamptz field is stored as UTC in db timezone, see problematic behavior below.
Severity
⚠️ Major: Breaks core functionality (e.g., migrations fail)
Reproduction
With a database set to a timezone other than UTC, here America/New_York (-5), see docker-compose.
schema.prisma
generator client {
provider = "prisma-client"
output = "generated"
}
datasource db {
provider = "postgresql"
}
model Test {
id Int @id @default(autoincrement())
createdAt DateTime @map("created_at") @db.Timestamptz(6)
}
test.js
import 'dotenv/config';
import { PrismaPg } from '@prisma/adapter-pg';
import { PrismaClient } from './prisma/generated/client.js';
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
const prisma = new PrismaClient({ adapter })
await prisma.test.create({
data: {
createdAt: new Date(),
},
});
Problematic Behavior
Prisma logs an UTC date "2025-11-21T10:23:41.021Z"
But db receives and stores that time as if was in its own timezone
SELECT * FROM "Test";
id | created_at
----+----------------------------
1 | 2025-11-21 10:23:41.021-05
(1 row)
Without PrismaPg, old v6 way using 'prisma-client-js' generator,
it's correctly stored as UTC
SELECT * FROM "Test";
id | created_at
----+----------------------------
1 | 2025-11-21 05:23:41.021-05
(1 row)
Frequency
Consistently reproducible
Does this occur in development or production?
Both development and production
Is this a regression?
Yes, works correctly the old way, without adapters.
Environment & Setup
docker-compose.yml
---
services:
db:
image: postgres:15-alpine
ports:
- "5432:5432"
environment:
POSTGRES_DB: db
POSTGRES_USER: db
POSTGRES_PASSWORD: db
TZ: America/New_York
command:
- "postgres"
- "-c"
- "log_statement=all"
volumes:
- db-data:/var/lib/postgresql/data
volumes:
db-data:
Prisma Version
7.0.0, but every version using Query Compiler is concerned.
Bug description
Follow up to #26786 with some precisions,
it's not a retrieval issue, dates are not stored correctly in db if db timezone isn't set to UTC.
Kinda severe for a pushed up feature which is now the default with v7, and a clear regression.
That's why I create a new issue.
It's mitigated though as DBs are commonly set to UTC.
Issue:
Date object intended to be stored in a Timestamptz field is stored as UTC in db timezone, see problematic behavior below.
Severity
Reproduction
With a database set to a timezone other than UTC, here America/New_York (-5), see docker-compose.
schema.prisma
test.js
Problematic Behavior
Prisma logs an UTC date "2025-11-21T10:23:41.021Z"
But db receives and stores that time as if was in its own timezone
Without PrismaPg, old v6 way using 'prisma-client-js' generator,
it's correctly stored as UTC
Frequency
Consistently reproducible
Does this occur in development or production?
Both development and production
Is this a regression?
Yes, works correctly the old way, without adapters.
Environment & Setup
docker-compose.yml
Prisma Version
7.0.0, but every version using Query Compiler is concerned.