mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-11 22:09:44 +00:00
refactor: Add frontend code to DB-GPT (#912)
This commit is contained in:
16
web/components/chart/autoChart/charts/util.ts
Normal file
16
web/components/chart/autoChart/charts/util.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
type BasicDataPropertyForAdvice = any;
|
||||
|
||||
/**
|
||||
* Process date column to new Date().
|
||||
* @param field
|
||||
* @param dataProps
|
||||
* @returns
|
||||
*/
|
||||
export function processDateEncode(field: string, dataProps: BasicDataPropertyForAdvice[]) {
|
||||
const dp = dataProps.find((dataProp) => dataProp.name === field);
|
||||
|
||||
if (dp?.recommendation === 'date') {
|
||||
return (d: any) => new Date(d[field]);
|
||||
}
|
||||
return field;
|
||||
}
|
Reference in New Issue
Block a user