fix: convert empty string to null on paste

Signed-off-by: mertmit <mertmit99@gmail.com>
This commit is contained in:
mertmit
2023-06-10 12:39:05 +03:00
parent fdb3bb502d
commit 9c1d347f0a

View File

@@ -13,6 +13,9 @@ export default function convertCellData(
const dateFormat = isMysql ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm:ssZ'
// return null if value is empty
if (value === '') return null
switch (to) {
case UITypes.Number: {
const parsedNumber = Number(value)
@@ -43,7 +46,7 @@ export default function convertCellData(
if (strval === 'true' || strval === '1') return true
if (strval === 'false' || strval === '0' || strval === '') return false
}
return Boolean(value)
return null
case UITypes.Date: {
const parsedDate = dayjs(value)
if (!parsedDate.isValid()) {