From 942993e7a9ae87cf8e5c5c048f58f70daa59deea Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Tue, 9 May 2023 19:54:06 +0800 Subject: [PATCH] fix(nocodb): revise mapAliasToColumn for mysql external db --- packages/nocodb/src/models/Model.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/nocodb/src/models/Model.ts b/packages/nocodb/src/models/Model.ts index 3b3deaa1d9..0d60abe431 100644 --- a/packages/nocodb/src/models/Model.ts +++ b/packages/nocodb/src/models/Model.ts @@ -488,10 +488,14 @@ export default class Model implements TableType { .format('YYYY-MM-DD HH:mm:ssZ'); } } else { - // External DB - keep it as it is - val = dayjs(val).format( - isMySQL ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm:ssZ', - ); + // External DB + if (isMySQL) { + // convert to utc + val = dayjs(val).utc().format('YYYY-MM-DD HH:mm:ss'); + } else { + // keep it as it is + val = dayjs(val).format('YYYY-MM-DD HH:mm:ssZ'); + } } } insertObj[sanitize(col.column_name)] = val;