aboutsummaryrefslogtreecommitdiff
path: root/modern/src/reports/components
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-09-04 10:53:05 -0700
committerAnton Tananaev <anton@traccar.org>2023-09-04 10:53:05 -0700
commit9a59d6524c45d5542433302a498f9ada4e45e806 (patch)
treeb779287db9104054ca5fbecf9f6218b2db46d8fe /modern/src/reports/components
parent63eaa20047613c872979e2894fbdb5a0caab31f7 (diff)
downloadtrackermap-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.jsx30
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;
}