You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Timestamps written through Prisma are shifted when PostgreSQL's time zone is not UTC #322
With a PostgreSQL whose timezone setting is not UTC, the timestamps the API writes through Prisma are shifted against the ones PostgreSQL computes itself.
Seen on 17 November 2026 while writing an integration test (#321), on a local PostgreSQL 18 with timezone = 'Africa/Harare' (UTC+2):
a deployment finished by the pipeline, written through Prisma (@prisma/adapter-pg), was stored as 11:44:51Z;
the same instant minus one second, written with a pg client parameter, was stored as 13:44:50Z;
the JavaScript Date behind both was 13:44:51Z.
So the row written through Prisma was two hours behind, the offset of the session time zone. The likely cause is that the adapter sends timestamps as UTC text without an offset, which PostgreSQL reads in the session time zone; I did not confirm it in the adapter's code. Restarting the same database with -c timezone=UTC removed the shift.
Who is affected
Not the documented installation: deploy/control-plane/compose.yml uses the official PostgreSQL image, whose default time zone is UTC, and CI does too.
Anyone who points DATABASE_URL at a PostgreSQL configured with another time zone. Values written through Prisma and values computed by SQL (now() in the raw queries of the rate limits and of replay protection, for example) would then disagree by the offset, so expiry and ordering could be wrong.
Expected
The API fixes the session time zone itself, so the result does not depend on the server's setting. Options to compare:
options=-c timezone=UTC on the connection (or the adapter's equivalent);
ALTER ROLE … SET timezone = 'UTC' for the runtime and migration roles in deploy/postgres/provision-runtime.mjs;
a startup check that refuses to run when SHOW timezone is not UTC.
Done when
An integration test runs against a database whose time zone is not UTC and sees the same instant from a Prisma write and from now().
docs/INSTALL.md or the SPEC says what the API requires or sets.
Activity