From 3035ed69bc7ea59c1c1ec314ec5e2a2db2574f07 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Tue, 16 May 2023 16:45:05 +0800 Subject: [PATCH] fix(nc-gui): revise datetime extraction regex --- packages/nc-gui/components/virtual-cell/Formula.vue | 4 ++-- packages/nc-gui/composables/useMultiSelect/index.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nc-gui/components/virtual-cell/Formula.vue b/packages/nc-gui/components/virtual-cell/Formula.vue index 06728df375..66f75dfd14 100644 --- a/packages/nc-gui/components/virtual-cell/Formula.vue +++ b/packages/nc-gui/components/virtual-cell/Formula.vue @@ -20,8 +20,8 @@ const { showEditNonEditableFieldWarning, showClearNonEditableFieldWarning, activ const renderResult = (result: string) => { // convert all date time values to local time - // the input is always YYYY-MM-DD hh:mm:ss+00:00 - return result.replace(/\b(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\+00:00)\b/g, (d) => { + // the input is always YYYY-MM-DD hh:mm:ss+xx:yy + return result.replace(/\b(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\+\d{2}:\d{2})\b/g, (d) => { // TODO(timezone): retrieve the format from the corresponding column meta // assume hh:mm at this moment return dayjs(d).utc().local().format('YYYY-MM-DD HH:mm') diff --git a/packages/nc-gui/composables/useMultiSelect/index.ts b/packages/nc-gui/composables/useMultiSelect/index.ts index 7854b81bbf..53c36b598c 100644 --- a/packages/nc-gui/composables/useMultiSelect/index.ts +++ b/packages/nc-gui/composables/useMultiSelect/index.ts @@ -117,7 +117,7 @@ export function useMultiSelect( } if (columnObj.uidt === UITypes.Formula) { - textToCopy = textToCopy.replace(/\b(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\+00:00)\b/g, (d: string) => { + textToCopy = textToCopy.replace(/\b(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\+\d{2}:\d{2})\b/g, (d: string) => { // TODO(timezone): retrieve the format from the corresponding column meta // assume hh:mm at this moment return dayjs(d).utc().local().format('YYYY-MM-DD HH:mm')