Browse Source

feat(nocodb): add timestamptz

pull/5505/head
Wing-Kam Wong 2 years ago
parent
commit
d4c11639b6
  1. 10
      packages/nocodb/src/db/BaseModelSqlv2.ts

10
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -1634,7 +1634,10 @@ class BaseModelSqlv2 {
break; break;
} else if (this.isPg) { } else if (this.isPg) {
// if there is no timezone info, convert it to UTC // 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 res[sanitize(column.title || column.column_name)] = this.dbDriver
.raw( .raw(
`?? AT TIME ZONE CURRENT_SETTING('timezone') AT TIME ZONE 'UTC'`, `?? 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 // postgres - timezone already attached to input
// e.g. 2023-05-11 16:16:51+08:00 // e.g. 2023-05-11 16:16:51+08:00
keepLocalTime = false; keepLocalTime = false;

Loading…
Cancel
Save