From fb98716ce7a83f470cdaf28365f654aa619f70d5 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Tue, 16 May 2023 18:04:17 +0800 Subject: [PATCH] fix(nocodb): sqlite xcdb / extdb logic --- packages/nocodb/src/models/Model.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/nocodb/src/models/Model.ts b/packages/nocodb/src/models/Model.ts index 0b8608f6df..1955790f3c 100644 --- a/packages/nocodb/src/models/Model.ts +++ b/packages/nocodb/src/models/Model.ts @@ -483,11 +483,8 @@ export default class Model implements TableType { // e.g. 2022-01-01 20:00:00+08:00 -> 2022-01-01 20:00:00 val = dayjs(val).format('YYYY-MM-DD HH:mm:ss'); } else if (isSqlite) { - // e.g. 2023-05-10T10:38:50.000Z -> 2023-05-10 10:38:50 - val = dayjs - .utc(val) - .utcOffset(d.getTimezoneOffset(), true) - .format('YYYY-MM-DD HH:mm:ss'); + // e.g. 2022-01-01T10:00:00.000Z -> 2022-01-01 10:00:00 + val = dayjs(val).utc().format('YYYY-MM-DD HH:mm:ss'); } else if (isPg) { // e.g. 2023-01-01T12:00:00.000Z -> 2023-01-01 20:00:00+08:00 val = dayjs(val).format('YYYY-MM-DD HH:mm:ssZ'); @@ -507,7 +504,9 @@ export default class Model implements TableType { // e.g. 2022-01-01 20:00:00Z -> 2022-01-02 04:00:00 // e.g. 2022-01-01 20:00:00+00:00 -> 2022-01-02 04:00:00 val = dayjs(val).format('YYYY-MM-DD HH:mm:ss'); - } else if (isSqlite || isMssql) { + } else if (isSqlite) { + val = dayjs(val).utc().format('YYYY-MM-DD HH:mm:ss'); + } else if (isMssql) { if (val.slice(-1) === 'Z') { // from UI val = dayjs(val).utc().format('YYYY-MM-DD HH:mm:ssZ');