diff options
author | Anton Tananaev <anton@traccar.org> | 2023-09-04 10:53:05 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-09-04 10:53:05 -0700 |
commit | 9a59d6524c45d5542433302a498f9ada4e45e806 (patch) | |
tree | b779287db9104054ca5fbecf9f6218b2db46d8fe /modern/src/reports/components | |
parent | 63eaa20047613c872979e2894fbdb5a0caab31f7 (diff) | |
download | trackermap-web-9a59d6524c45d5542433302a498f9ada4e45e806.tar.gz trackermap-web-9a59d6524c45d5542433302a498f9ada4e45e806.tar.bz2 trackermap-web-9a59d6524c45d5542433302a498f9ada4e45e806.zip |
Migrate to DayJs from moment
Diffstat (limited to 'modern/src/reports/components')
-rw-r--r-- | modern/src/reports/components/ReportFilter.jsx | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/modern/src/reports/components/ReportFilter.jsx b/modern/src/reports/components/ReportFilter.jsx index ff0dc146..eab7d0eb 100644 --- a/modern/src/reports/components/ReportFilter.jsx +++ b/modern/src/reports/components/ReportFilter.jsx @@ -3,7 +3,7 @@ import { FormControl, InputLabel, Select, MenuItem, Button, TextField, Typography, } from '@mui/material'; import { useDispatch, useSelector } from 'react-redux'; -import moment from 'moment'; +import dayjs from 'dayjs'; import { useTranslation } from '../../common/components/LocalizationProvider'; import useReportStyles from '../common/useReportStyles'; import { devicesActions, reportsActions } from '../../store'; @@ -47,32 +47,32 @@ const ReportFilter = ({ children, handleSubmit, handleSchedule, showOnly, ignore let selectedTo; switch (period) { case 'today': - selectedFrom = moment().startOf('day'); - selectedTo = moment().endOf('day'); + selectedFrom = dayjs().startOf('day'); + selectedTo = dayjs().endOf('day'); break; case 'yesterday': - selectedFrom = moment().subtract(1, 'day').startOf('day'); - selectedTo = moment().subtract(1, 'day').endOf('day'); + selectedFrom = dayjs().subtract(1, 'day').startOf('day'); + selectedTo = dayjs().subtract(1, 'day').endOf('day'); break; case 'thisWeek': - selectedFrom = moment().startOf('week'); - selectedTo = moment().endOf('week'); + selectedFrom = dayjs().startOf('week'); + selectedTo = dayjs().endOf('week'); break; case 'previousWeek': - selectedFrom = moment().subtract(1, 'week').startOf('week'); - selectedTo = moment().subtract(1, 'week').endOf('week'); + selectedFrom = dayjs().subtract(1, 'week').startOf('week'); + selectedTo = dayjs().subtract(1, 'week').endOf('week'); break; case 'thisMonth': - selectedFrom = moment().startOf('month'); - selectedTo = moment().endOf('month'); + selectedFrom = dayjs().startOf('month'); + selectedTo = dayjs().endOf('month'); break; case 'previousMonth': - selectedFrom = moment().subtract(1, 'month').startOf('month'); - selectedTo = moment().subtract(1, 'month').endOf('month'); + selectedFrom = dayjs().subtract(1, 'month').startOf('month'); + selectedTo = dayjs().subtract(1, 'month').endOf('month'); break; default: - selectedFrom = moment(from, moment.HTML5_FMT.DATETIME_LOCAL); - selectedTo = moment(to, moment.HTML5_FMT.DATETIME_LOCAL); + selectedFrom = dayjs(from, 'YYYY-MM-DDTHH:mm'); + selectedTo = dayjs(to, 'YYYY-MM-DDTHH:mm'); break; } |