Skip to content

Commit

Permalink
Merge pull request #122 from CDOT-CV/intersection-dashboard-hotfix
Browse files Browse the repository at this point in the history
Intersection dashboard hotfix
  • Loading branch information
drewjj authored Nov 4, 2024
2 parents 5e3c9d1 + 127f505 commit e5b99e5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
1 change: 1 addition & 0 deletions webapp/src/apis/intersections/events-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class EventsApi {
token: token,
queryParams: queryParams,
abortController,
toastOnFailure: false,
failureMessage: `Failed to retrieve events of type ${eventTypeObj.value}`,
})) ?? []
events.push(...response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ export const DataSelectorEditForm = (props: {
<Grid item md={4} xs={12}>
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DateTimePicker
value={formik.values.startDate}
onChange={(e) => formik.setFieldValue('startDate', e as Date | null, true)}
value={dayjs(formik.values.startDate)}
onChange={(e) => formik.setFieldValue('startDate', e?.toDate(), true)}
/>
</LocalizationProvider>
</Grid>
Expand Down
15 changes: 13 additions & 2 deletions webapp/src/features/intersections/reports/report-list-filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Close } from '@mui/icons-material'
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'

import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'
import dayjs from 'dayjs'

const FiltersDrawerDesktop = styled(Drawer)({
flexShrink: 0,
Expand Down Expand Up @@ -103,8 +104,18 @@ export const ReportListFilters = (props: ReportListFiltersProps) => {
</Typography>
<Stack spacing={2} sx={{ mt: 2 }}>
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DateTimePicker label="From" onChange={startDateChange} value={currentFilters.startDate} disabled={loading} />
<DateTimePicker label="To" onChange={endDateChange} value={currentFilters.endDate} disabled={loading} />
<DateTimePicker
label="From"
onChange={(e) => startDateChange(e?.toDate())}
value={dayjs(currentFilters.startDate)}
disabled={loading}
/>
<DateTimePicker
label="To"
onChange={(e) => endDateChange(e?.toDate())}
value={dayjs(currentFilters.endDate)}
disabled={loading}
/>
</LocalizationProvider>
</Stack>
{!filtersValid[0] && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { LocalizationProvider } from '@mui/x-date-pickers'
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker'
import { Button, Card, CardActions, CardContent, Divider, Grid, TextField } from '@mui/material'
import dayjs from 'dayjs'

type Props = {
onGenerateReport: ({
Expand Down Expand Up @@ -79,17 +80,17 @@ export const ReportRequestEditForm = (props: Props) => {
<Grid item md={4} xs={12}>
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DateTimePicker
value={formik.values.startDate}
onChange={(e) => formik.setFieldValue('startDate', e as Date | null, true)}
value={dayjs(formik.values.startDate)}
onChange={(e) => formik.setFieldValue('startDate', e?.toDate(), true)}
disableFuture
/>
</LocalizationProvider>
</Grid>
<Grid item md={4} xs={12}>
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DateTimePicker
value={formik.values.endDate}
onChange={(e) => formik.setFieldValue('endDate', e as Date | null, true)}
value={dayjs(formik.values.endDate)}
onChange={(e) => formik.setFieldValue('endDate', e?.toDate(), true)}
disableFuture
/>
</LocalizationProvider>
Expand Down

0 comments on commit e5b99e5

Please sign in to comment.