diff --git a/src/features/smartSearch/components/filters/TimeFrame.tsx b/src/features/smartSearch/components/filters/TimeFrame.tsx index 19bfbdf8be..0274b852cb 100644 --- a/src/features/smartSearch/components/filters/TimeFrame.tsx +++ b/src/features/smartSearch/components/filters/TimeFrame.tsx @@ -1,15 +1,16 @@ +import dayjs from 'dayjs'; import { MenuItem, Typography } from '@mui/material'; import { useEffect, useState } from 'react'; import { getNewDateWithOffset } from 'utils/dateUtils'; import { getTimeFrameWithConfig } from '../utils'; import { Msg } from 'core/i18n'; -import StyledDatePicker from '../inputs/StyledDatePicker'; import StyledNumberInput from '../inputs/StyledNumberInput'; import StyledSelect from '../inputs/StyledSelect'; import { TIME_FRAME } from 'features/smartSearch/components/types'; import messageIds from 'features/smartSearch/l10n/messageIds'; +import StyledDatePicker from '../inputs/StyledDatePicker'; interface TimeFrameProps { onChange: (range: { after?: string; before?: string }) => void; @@ -60,14 +61,22 @@ const TimeFrame = ({ const afterDateSelect = ( setAfter(date as unknown as Date)} - value={after} + onChange={(date) => { + if (date) { + setAfter(date.toDate()); + } + }} + value={dayjs(after)} /> ); const beforeDateSelect = ( setBefore(date as unknown as Date)} - value={before} + onChange={(date) => { + if (date) { + setBefore(date.toDate()); + } + }} + value={dayjs(before)} /> ); const timeFrameSelect = ( diff --git a/src/features/smartSearch/components/inputs/StyledDatePicker.tsx b/src/features/smartSearch/components/inputs/StyledDatePicker.tsx index 034f4007db..8f023c94a3 100644 --- a/src/features/smartSearch/components/inputs/StyledDatePicker.tsx +++ b/src/features/smartSearch/components/inputs/StyledDatePicker.tsx @@ -1,15 +1,32 @@ +import dayjs from 'dayjs'; +import { useTheme } from '@mui/material'; import { DatePicker, DatePickerProps } from '@mui/x-date-pickers/DatePicker'; -const styles = { - fontSize: 'typography.h4.fontSize', - padding: 0, - width: '12rem', -}; - -const StyledDatePicker: React.FC> = ( +const StyledDatePicker: React.FC> = ( props ): React.ReactElement => { - return ; + const theme = useTheme(); + return ( + + ); }; export default StyledDatePicker;