|
|
@ -3301,19 +3301,30 @@ class BaseModelSqlv2 { |
|
|
|
if (d) { |
|
|
|
if (d) { |
|
|
|
for (const col of dateTimeColumns) { |
|
|
|
for (const col of dateTimeColumns) { |
|
|
|
if (d[col.title]) { |
|
|
|
if (d[col.title]) { |
|
|
|
|
|
|
|
let keepLocalTime = true; |
|
|
|
|
|
|
|
|
|
|
|
if (this.isSqlite) { |
|
|
|
if (this.isSqlite) { |
|
|
|
if (!col.cdf && !isXcdbBase) { |
|
|
|
if (!col.cdf) { |
|
|
|
if (d[col.title].indexOf('+') > -1) { |
|
|
|
if ( |
|
|
|
// e.g. 2023-05-10 10:25:45+00:00
|
|
|
|
d[col.title].indexOf('+') === -1 && |
|
|
|
// timezone already attached to input
|
|
|
|
d[col.title].slice(-1) !== 'Z' |
|
|
|
// hence, skip it
|
|
|
|
) { |
|
|
|
|
|
|
|
// if there is no timezone info,
|
|
|
|
|
|
|
|
// we assume the input is on NocoDB server timezone
|
|
|
|
|
|
|
|
// then we convert to UTC from server timezone
|
|
|
|
|
|
|
|
// e.g. 2023-04-27 10:00:00 (IST) -> 2023-04-27 04:30:00+00:00
|
|
|
|
|
|
|
|
d[col.title] = dayjs(d[col.title]) |
|
|
|
|
|
|
|
.tz(Intl.DateTimeFormat().resolvedOptions().timeZone) |
|
|
|
|
|
|
|
.utc() |
|
|
|
|
|
|
|
.format('YYYY-MM-DD HH:mm:ssZ'); |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// otherwise, we convert from the given timezone to UTC
|
|
|
|
|
|
|
|
keepLocalTime = false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let keepLocalTime = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.isPg && col.dt === 'timestamp with time zone') { |
|
|
|
if (this.isPg && col.dt === 'timestamp with time zone') { |
|
|
|
// 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
|
|
|
|