Browse Source

fix(nc-gui): revise paste datetime logic

pull/5602/head
Wing-Kam Wong 2 years ago
parent
commit
11e27ca498
  1. 16
      packages/nc-gui/composables/useMultiSelect/convertCellData.ts

16
packages/nc-gui/composables/useMultiSelect/convertCellData.ts

@ -47,12 +47,22 @@ export default function convertCellData(
}
if (isXcdbBase) {
if (isMysql) {
// UTC + 'Z'
return `${parsedDateTime.format('YYYY-MM-DD HH:mm:ss')}Z`
let res = `${parsedDateTime.format('YYYY-MM-DD HH:mm:ss')}`
if (!dayjs.isDayjs(value)) {
// UTC + 'Z'
res += 'Z'
}
return res
} else if (isMssql) {
return parsedDateTime.utc().format('YYYY-MM-DD HH:mm:ssZ')
} else {
return parsedDateTime.utc(true).format('YYYY-MM-DD HH:mm:ssZ')
if (!dayjs.isDayjs(value)) {
// e.g. copy the existing cell - 2023-05-06 13:06:51 (UTC)
return parsedDateTime.utc(true).format('YYYY-MM-DD HH:mm:ssZ')
}
// e.g. copy right after setting by datepicker
// value includes timezone
return parsedDateTime
}
}
// TODO(timezone): keep ext db as it is

Loading…
Cancel
Save