Skip to content

Commit ae78ca6

Browse files
committed
convert DateTime in dateColumn
1 parent 6efea95 commit ae78ca6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/components/Grid/ColumnTypes/dateColumn.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
GridValueGetter as ValueGetter,
77
} from '@mui/x-data-grid';
88
import { Nil } from '@seedcompany/common';
9+
import { DateTime } from 'luxon';
910
import { DateFilter } from '~/api/schema.graphql';
1011
import { CalendarDate } from '~/common';
1112
import { GridHeaderAddFilterButton } from '../GridHeaderAddFilterButton';
@@ -41,9 +42,15 @@ dateColumn.valueGetter =
4142
if (!value) {
4243
return null;
4344
}
45+
4446
if (CalendarDate.isDate(value)) {
4547
return value.toJSDate();
4648
}
49+
50+
if (DateTime.isDateTime(value)) {
51+
return value.toJSDate();
52+
}
53+
4754
if (typeof value === 'string') {
4855
return CalendarDate.fromISO(value).toJSDate();
4956
}

0 commit comments

Comments
 (0)