Browse Source

feat(nc-gui): handle copy for datetime in formula

pull/5642/head
Wing-Kam Wong 2 years ago
parent
commit
1e58d54cbf
  1. 9
      packages/nc-gui/composables/useMultiSelect/index.ts

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

@ -116,11 +116,18 @@ export function useMultiSelect(
textToCopy = JSON.stringify(textToCopy) textToCopy = JSON.stringify(textToCopy)
} }
if (columnObj.uidt === UITypes.DateTime) { if (columnObj.uidt === UITypes.DateTime || columnObj.uidt === UITypes.Formula) {
// remove `"` // remove `"`
// e.g. "2023-05-12T08:03:53.000Z" -> 2023-05-12T08:03:53.000Z // e.g. "2023-05-12T08:03:53.000Z" -> 2023-05-12T08:03:53.000Z
textToCopy = textToCopy.replace(/["']/g, '') textToCopy = textToCopy.replace(/["']/g, '')
// TODO(timezone): handle date in string
if (columnObj.uidt === UITypes.Formula) {
if (!dayjs(textToCopy).isValid()) {
return
}
}
const isMySQL = isMysql(columnObj.base_id) const isMySQL = isMysql(columnObj.base_id)
if (isMySQL) { if (isMySQL) {
if (textToCopy.indexOf('+') === -1) { if (textToCopy.indexOf('+') === -1) {

Loading…
Cancel
Save