mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
set common format for import export of date/time
This commit is contained in:
@@ -34,10 +34,9 @@ export const config: IFieldConfig = {
|
||||
SideDrawerField,
|
||||
filter: { operators: filterOperators, valueFormatter },
|
||||
settings: Settings,
|
||||
csvImportParser: (value, config) =>
|
||||
parse(value, config?.format ?? DATE_FORMAT, new Date()),
|
||||
csvImportParser: (value, config) => parse(value, DATE_FORMAT, new Date()),
|
||||
csvExportFormatter: (value: any, config?: any) =>
|
||||
format(value.toDate(), config?.format ?? DATE_FORMAT),
|
||||
format(value.toDate(), DATE_FORMAT),
|
||||
};
|
||||
export default config;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { lazy } from "react";
|
||||
import { IFieldConfig, FieldType } from "@src/components/fields/types";
|
||||
import withRenderTableCell from "@src/components/Table/TableCell/withRenderTableCell";
|
||||
import { parseJSON, format } from "date-fns";
|
||||
import { format } from "date-fns";
|
||||
import { DATE_TIME_FORMAT } from "@src/constants/dates";
|
||||
|
||||
import DateTimeIcon from "@mui/icons-material/AccessTime";
|
||||
@@ -46,9 +46,9 @@ export const config: IFieldConfig = {
|
||||
customInput: FilterCustomInput,
|
||||
},
|
||||
settings: Settings,
|
||||
csvImportParser: (value) => parseJSON(value).getTime(),
|
||||
csvImportParser: (value) => new Date(value),
|
||||
csvExportFormatter: (value: any, config?: any) =>
|
||||
format(value.toDate(), config?.format ?? DATE_TIME_FORMAT),
|
||||
format(value.toDate(), DATE_TIME_FORMAT),
|
||||
};
|
||||
export default config;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user