diff --git a/packages/nc-gui/components/virtual-cell/Formula.vue b/packages/nc-gui/components/virtual-cell/Formula.vue index 66eea04dd3..06728df375 100644 --- a/packages/nc-gui/components/virtual-cell/Formula.vue +++ b/packages/nc-gui/components/virtual-cell/Formula.vue @@ -11,7 +11,7 @@ const cellValue = inject(CellValueInj) const { isPg } = useProject() -const result = computed(() => (isPg(column.value.base_id) ? handleTZ(cellValue?.value) : cellValue?.value)) +const result = computed(() => (isPg(column.value.base_id) ? renderResult(handleTZ(cellValue?.value)) : renderResult(cellValue?.value))) const urls = computed(() => replaceUrlsWithLink(result.value)) @@ -21,10 +21,10 @@ 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(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\+00:00$/, (d) => { + return result.replace(/\b(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\+00:00)\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') + return dayjs(d).utc().local().format('YYYY-MM-DD HH:mm') }) } @@ -41,7 +41,7 @@ const renderResult = (result: string) => {
-
{{ renderResult(result) }}
+
{{ result }}
{{ $t('msg.info.computedFieldEditWarning') }}