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 (isXcdbBase) {
if (isMysql) { if (isMysql) {
// UTC + 'Z' let res = `${parsedDateTime.format('YYYY-MM-DD HH:mm:ss')}`
return `${parsedDateTime.format('YYYY-MM-DD HH:mm:ss')}Z` if (!dayjs.isDayjs(value)) {
// UTC + 'Z'
res += 'Z'
}
return res
} else if (isMssql) { } else if (isMssql) {
return parsedDateTime.utc().format('YYYY-MM-DD HH:mm:ssZ') return parsedDateTime.utc().format('YYYY-MM-DD HH:mm:ssZ')
} else { } 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 // TODO(timezone): keep ext db as it is

Loading…
Cancel
Save