refactor(nc-gui): move the logic to backend

This commit is contained in:
Wing-Kam Wong
2023-04-27 19:55:28 +08:00
parent de903a1deb
commit 1f1d3bf374
2 changed files with 2 additions and 18 deletions

View File

@@ -7,8 +7,6 @@ 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)) {
@@ -44,17 +42,7 @@ export default function convertCellData(
if (!parsedDateTime.isValid()) {
throw new Error('Not a valid datetime value')
}
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')
return parsedDateTime.format(dateFormat)
}
case UITypes.Time: {
let parsedTime = dayjs(value)