|
|
|
@ -7,6 +7,8 @@ import { parseProp } from '#imports'
|
|
|
|
|
export default function convertCellData( |
|
|
|
|
args: { from: UITypes; to: UITypes; value: any; column: ColumnType; appInfo: AppInfo }, |
|
|
|
|
isMysql = false, |
|
|
|
|
isSqlite = false, |
|
|
|
|
isXcdbBase = false, |
|
|
|
|
) { |
|
|
|
|
const { from, to, value } = args |
|
|
|
|
if (from === to && ![UITypes.Attachment, UITypes.Date, UITypes.DateTime, UITypes.Time, UITypes.Year].includes(to)) { |
|
|
|
@ -42,7 +44,17 @@ export default function convertCellData(
|
|
|
|
|
if (!parsedDateTime.isValid()) { |
|
|
|
|
throw new Error('Not a valid datetime value') |
|
|
|
|
} |
|
|
|
|
return parsedDateTime.format(dateFormat) |
|
|
|
|
if (isXcdbBase) { |
|
|
|
|
if (isMysql) { |
|
|
|
|
return parsedDateTime?.format('YYYY-MM-DD HH:mm:ss') |
|
|
|
|
} else if (isSqlite) { |
|
|
|
|
return parsedDateTime.utc().format('YYYY-MM-DD HH:mm:ss') |
|
|
|
|
} else { |
|
|
|
|
return parsedDateTime.utc().format('YYYY-MM-DD HH:mm:ssZ') |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// TODO(timezone): keep ext db as it is
|
|
|
|
|
return parsedDateTime.format(isMysql ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm:ssZ') |
|
|
|
|
} |
|
|
|
|
case UITypes.Time: { |
|
|
|
|
let parsedTime = dayjs(value) |
|
|
|
|