Browse Source

feat(nc-gui): handle date month copy

pull/6870/head
աɨռɢӄաօռɢ 1 year ago
parent
commit
72d7b4044b
  1. 12
      packages/nc-gui/composables/useMultiSelect/index.ts

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

@ -13,6 +13,7 @@ import {
dateFormats,
extractPkFromRow,
extractSdkResponseErrorMsg,
isDateMonthFormat,
isDrawerOrModalExist,
isExpandedCellInputExist,
isMac,
@ -153,6 +154,17 @@ export function useMultiSelect(
}
}
if (columnObj.uidt === UITypes.Date) {
const dateFormat = columnObj.meta.date_format
if (isDateMonthFormat(dateFormat)) {
// any date month format (e.g. YYYY-MM) couldn't be stored in database
// with date type since it is not a valid date
// therefore, we reformat the value here to display with the formatted one
// e.g. 2023-06-03 -> 2023-06
textToCopy = dayjs(textToCopy, dateFormat).format(dateFormat)
}
}
if (columnObj.uidt === UITypes.Time) {
// remove `"`
// e.g. "2023-05-12T08:03:53.000Z" -> 2023-05-12T08:03:53.000Z

Loading…
Cancel
Save