From e51ea65862d4962922c80dba40c611d0e6727175 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Thu, 11 May 2023 17:28:24 +0800 Subject: [PATCH] fix(nocodb): mysql xcdb api response logic --- packages/nocodb/src/db/BaseModelSqlv2.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index 969c4bb8dd..75325c5b77 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -3273,7 +3273,20 @@ class BaseModelSqlv2 { let keepLocalTime = true; if (this.isMySQL) { - if (!isXcdbBase) { + if (isXcdbBase) { + if (d[col.title].indexOf('+') === -1) { + // no timezone info - considered as UTC + // e.g. 2023-05-11 12:00:00+00:00 (in DB) + // d[col.title] = 2023-05-11 04:00:00 + d[col.title] = dayjs(d[col.title]).format( + 'YYYY-MM-DD HH:mm:ss', + ); + if (d[col.title].slice(-1) !== 'Z') { + // e.g. 2023-05-11 04:00:00 -> 2023-05-11 04:00:00Z + d[col.title] += 'Z'; + } + } + } else { if (d[col.title].indexOf('+') > -1) { // timezone info found -> skip continue;