Browse Source

fix(nocodb): handle timezone with offset in sqlite

pull/5601/head
Wing-Kam Wong 2 years ago
parent
commit
7e51d3fbe7
  1. 10
      packages/nocodb-nest/src/models/Model.ts

10
packages/nocodb-nest/src/models/Model.ts

@ -466,7 +466,15 @@ export default class Model implements TableType {
.format('YYYY-MM-DD HH:mm:ss'); .format('YYYY-MM-DD HH:mm:ss');
} }
} else if (isSqlite) { } else if (isSqlite) {
val = dayjs(val).utc().format('YYYY-MM-DD HH:mm:ss'); let keepLocalTime = false;
if (val.slice(-1) === 'Z') {
// from UI
keepLocalTime = true;
}
val = dayjs
.utc(val)
.utcOffset(d.getTimezoneOffset(), keepLocalTime)
.format('YYYY-MM-DD HH:mm:ss');
} else { } else {
let keepLocalTime = false; let keepLocalTime = false;
if (val.slice(-1) === 'Z') { if (val.slice(-1) === 'Z') {

Loading…
Cancel
Save