Browse Source

fix(nc-gui): handle mysql copy edge case

pull/5642/head
Wing-Kam Wong 1 year ago
parent
commit
5c7c45313b
  1. 10
      packages/nc-gui/composables/useMultiSelect/index.ts

10
packages/nc-gui/composables/useMultiSelect/index.ts

@ -119,9 +119,15 @@ export function useMultiSelect(
if (columnObj.uidt === UITypes.DateTime) {
let d = dayjs(textToCopy)
if (!d.isValid()) {
// e.g. textToCopy = 2023-05-06T05:12:29.000Z
const isMySQL = isMysql(columnObj.base_id)
// insert a datetime value, copy the value without refreshing
// e.g. textToCopy = 2023-05-12T03:49:25.000Z
// feed custom parse format
d = dayjs(textToCopy, isMysql(columnObj.base_id) ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm:ssZ')
d = dayjs(textToCopy, isMySQL ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm:ssZ')
if (isMySQL) {
// convert to local time - e.g. 2023-05-12T11:49:25+08:00
d = dayjs(d).utc(true).local()
}
}
// users can change the datetime format in UI
// `textToCopy` would be always in YYYY-MM-DD HH:mm:ss(Z / +xx:yy) format

Loading…
Cancel
Save