Browse Source

Merge pull request #1869 from nocodb/fix/1864-cnum-date-calculation

fix: ignore date formatting if type is not string
pull/1877/head
navi 3 years ago committed by GitHub
parent
commit
a626c4187c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      packages/nc-gui/components/project/spreadsheet/components/virtualCell/formulaCell.vue

1
packages/nc-gui/components/project/spreadsheet/components/virtualCell/formulaCell.vue

@ -49,6 +49,7 @@ export default {
// handle date returned from PostgreSQL // handle date returned from PostgreSQL
handleTZ(val) { handleTZ(val) {
if (!val) { return } 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 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') return dayjs(v).format('YYYY-MM-DD HH:mm')
}) })

Loading…
Cancel
Save