|
|
@ -56,22 +56,24 @@ export const isPrimary = (column: ColumnType) => !!column.pv |
|
|
|
export const isPrimaryKey = (column: ColumnType) => !!column.pk |
|
|
|
export const isPrimaryKey = (column: ColumnType) => !!column.pk |
|
|
|
|
|
|
|
|
|
|
|
// used for LTAR and Formula
|
|
|
|
// used for LTAR and Formula
|
|
|
|
export const renderValue = (isMssql: boolean, result?: any) => { |
|
|
|
export const renderValue = (result?: any) => { |
|
|
|
if (!result || typeof result !== 'string') { |
|
|
|
if (!result || typeof result !== 'string') { |
|
|
|
return result |
|
|
|
return result |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (isMssql) { |
|
|
|
// cater MYSQL
|
|
|
|
if (dayjs(result).isValid()) { |
|
|
|
result = result.replace('.000000', '') |
|
|
|
// convert to YYYY-MM-DD hh:mm:ssZ
|
|
|
|
|
|
|
|
|
|
|
|
// convert ISO string (e.g. in MSSQL) to YYYY-MM-DD hh:mm:ssZ
|
|
|
|
// e.g. 2023-05-18T05:30:00.000Z -> 2023-05-18 11:00:00+05:30
|
|
|
|
// e.g. 2023-05-18T05:30:00.000Z -> 2023-05-18 11:00:00+05:30
|
|
|
|
result = dayjs(result).format('YYYY-MM-DD HH:mm:ssZ') |
|
|
|
result = result.replace(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/, (d: string) => { |
|
|
|
} |
|
|
|
return dayjs(d).format('YYYY-MM-DD HH:mm:ssZ') |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// convert all date time values to local time
|
|
|
|
// convert all date time values to local time
|
|
|
|
// the datetime is either YYYY-MM-DD hh:mm:ss (xcdb)
|
|
|
|
// the datetime is either YYYY-MM-DD hh:mm:ss (xcdb)
|
|
|
|
// or YYYY-MM-DD hh:mm:ss+xx:yy (ext)
|
|
|
|
// or YYYY-MM-DD hh:mm:ss+xx:yy (ext)
|
|
|
|
return result.replace('.000000', '').replace(/\b(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})(\+\d{2}:\d{2})?\b/g, (d: string) => { |
|
|
|
return result.replace(/\b(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})(\+\d{2}:\d{2})?\b/g, (d: string) => { |
|
|
|
// TODO(timezone): retrieve the format from the corresponding column meta
|
|
|
|
// TODO(timezone): retrieve the format from the corresponding column meta
|
|
|
|
// assume hh:mm at this moment
|
|
|
|
// assume hh:mm at this moment
|
|
|
|
return dayjs(d).utc(!result.includes('+')).local().format('YYYY-MM-DD HH:mm') |
|
|
|
return dayjs(d).utc(!result.includes('+')).local().format('YYYY-MM-DD HH:mm') |
|
|
|