这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged

Develop #1198

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/components/fields/Date/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@ export const config: IFieldConfig = {
filter: { operators: filterOperators, valueFormatter },
settings: Settings,
csvImportParser: (value, config) => parse(value, DATE_FORMAT, new Date()),
csvExportFormatter: (value: any, config?: any) =>
format(value.toDate(), DATE_FORMAT),
csvExportFormatter: (value: any, config?: any) => {
if (typeof value === "number") {
return format(new Date(value), DATE_FORMAT);
} else {
return format(value.toDate(), DATE_FORMAT);
}
},
};
export default config;

Expand Down
9 changes: 7 additions & 2 deletions src/components/fields/DateTime/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,13 @@ export const config: IFieldConfig = {
},
settings: Settings,
csvImportParser: (value) => new Date(value),
csvExportFormatter: (value: any, config?: any) =>
format(value.toDate(), DATE_TIME_FORMAT),
csvExportFormatter: (value: any, config?: any) => {
if (typeof value === "number") {
return format(new Date(value), DATE_TIME_FORMAT);
} else {
return format(value.toDate(), DATE_TIME_FORMAT);
}
},
};
export default config;

Expand Down