Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/orm/src/client/crud/dialects/postgresql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ export class PostgresCrudDialect<Schema extends SchemaDef> extends BaseCrudDiale

private transformOutputDate(value: unknown) {
if (typeof value === 'string') {
return new Date(value);
// PostgreSQL's jsonb_build_object serializes timestamptz as ISO 8601 strings
// in UTC but without the 'Z' suffix (e.g., "2023-01-01T12:00:00.123456").
// We add 'Z' to explicitly mark them as UTC for correct Date object creation.
return new Date(value.endsWith('Z') ? value : `${value}Z`);
} else if (value instanceof Date && this.options.fixPostgresTimezone !== false) {
// SPECIAL NOTES:
// node-pg has a terrible quirk that it returns the date value in local timezone
Expand Down