From d4c11639b60737468e3984035bd5ebde4186f8cf Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Thu, 18 May 2023 16:30:24 +0800 Subject: [PATCH] feat(nocodb): add timestamptz --- packages/nocodb/src/db/BaseModelSqlv2.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index 4247742f1f..afc1ce2ecf 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -1634,7 +1634,10 @@ class BaseModelSqlv2 { break; } else if (this.isPg) { // if there is no timezone info, convert it to UTC - if (column.dt !== 'timestamp with time zone') { + if ( + column.dt !== 'timestamp with time zone' && + column.dt !== 'timestamptz' + ) { res[sanitize(column.title || column.column_name)] = this.dbDriver .raw( `?? AT TIME ZONE CURRENT_SETTING('timezone') AT TIME ZONE 'UTC'`, @@ -3339,7 +3342,10 @@ class BaseModelSqlv2 { } } - if (this.isPg && col.dt === 'timestamp with time zone') { + if ( + this.isPg && + (col.dt === 'timestamp with time zone' || col.dt === 'timestamptz') + ) { // postgres - timezone already attached to input // e.g. 2023-05-11 16:16:51+08:00 keepLocalTime = false;