From cdef167078cfcb57e1595fedb6f6616850720a07 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 26 Apr 2022 01:20:33 +0530 Subject: [PATCH] fix: ignore date formatting if type is not string re #1864 Signed-off-by: Pranav C --- .../project/spreadsheet/components/virtualCell/formulaCell.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/formulaCell.vue b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/formulaCell.vue index 5f7ff04b7e..25f9db470d 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/formulaCell.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/formulaCell.vue @@ -49,6 +49,7 @@ export default { // handle date returned from PostgreSQL handleTZ(val) { if (!val) { return } + if (typeof val !== 'string') { return val } return val.replace(/((?:-?(?:[1-9][0-9]*)?[0-9]{4})-(?:1[0-2]|0[1-9])-(?:3[01]|0[1-9]|[12][0-9])T(?:2[0-3]|[01][0-9]):(?:[0-5][0-9]):(?:[0-5][0-9])(?:\.[0-9]+)?(?:Z|[+-](?:2[0-3]|[01][0-9]):[0-5][0-9]))/g, (i, v) => { return dayjs(v).format('YYYY-MM-DD HH:mm') })