Browse Source

fix(gui): year validation correction

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4514/head
Pranav C 2 years ago
parent
commit
e51be1b2f2
  1. 12
      packages/nc-gui/composables/useMultiSelect/convertCellData.ts

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

@ -46,15 +46,17 @@ export default function convertCellData(args: { from: UITypes; to: UITypes; valu
return parsedTime.format(dateFormat)
}
case UITypes.Year: {
if (/^\d+$/.test(value)) {
return +value
}
const parsedDate = dayjs(value)
if (!parsedDate.isValid()) {
if (parsedDate.isValid()) {
return parsedDate.format('YYYY')
}
if (/^\d+$/.test(value)) {
throw new Error('Not a valid year value')
}
return value
throw new Error('Not a valid year value')
}
case UITypes.Attachment: {
let parsedVal

Loading…
Cancel
Save