diff options
Diffstat (limited to 'modern')
-rw-r--r-- | modern/src/common/util/formatter.js | 1 | ||||
-rw-r--r-- | modern/src/reports/ChartReportPage.js | 4 | ||||
-rw-r--r-- | modern/src/reports/EventReportPage.js | 4 | ||||
-rw-r--r-- | modern/src/reports/StatisticsPage.js | 4 | ||||
-rw-r--r-- | modern/src/reports/StopReportPage.js | 4 | ||||
-rw-r--r-- | modern/src/reports/SummaryReportPage.js | 4 | ||||
-rw-r--r-- | modern/src/reports/TripReportPage.js | 4 |
7 files changed, 12 insertions, 13 deletions
diff --git a/modern/src/common/util/formatter.js b/modern/src/common/util/formatter.js index 43f172f9..d3ee835a 100644 --- a/modern/src/common/util/formatter.js +++ b/modern/src/common/util/formatter.js @@ -10,7 +10,6 @@ export const formatNumber = (value, precision = 1) => Number(value.toFixed(preci export const formatPercentage = (value) => `${value}%`; -export const formatDate = (value, format = 'YYYY-MM-DD HH:mm') => moment(value).format(format); export const formatTime = (value, format = 'YYYY-MM-DD HH:mm:ss') => moment(value).format(format); export const formatStatus = (value, t) => t(prefixString('deviceStatus', value)); diff --git a/modern/src/reports/ChartReportPage.js b/modern/src/reports/ChartReportPage.js index ceb2361b..3a2dfbf2 100644 --- a/modern/src/reports/ChartReportPage.js +++ b/modern/src/reports/ChartReportPage.js @@ -6,7 +6,7 @@ import { CartesianGrid, Line, LineChart, ResponsiveContainer, Tooltip, XAxis, YAxis, } from 'recharts'; import ReportFilter from './components/ReportFilter'; -import { formatDate } from '../common/util/formatter'; +import { formatTime } from '../common/util/formatter'; import { useTranslation } from '../common/components/LocalizationProvider'; import PageLayout from '../common/components/PageLayout'; import ReportsMenu from './components/ReportsMenu'; @@ -42,7 +42,7 @@ const ChartReportPage = () => { const formattedPositions = positions.map((position) => { const data = { ...position, ...position.attributes }; const formatted = {}; - formatted.fixTime = formatDate(position.fixTime, 'HH:mm:ss'); + formatted.fixTime = formatTime(position.fixTime, 'HH:mm:ss'); Object.keys(data).forEach((key) => { const value = data[key]; if (typeof value === 'number') { diff --git a/modern/src/reports/EventReportPage.js b/modern/src/reports/EventReportPage.js index 61b55fcc..87ea1ee8 100644 --- a/modern/src/reports/EventReportPage.js +++ b/modern/src/reports/EventReportPage.js @@ -3,7 +3,7 @@ import { FormControl, InputLabel, Select, MenuItem, Table, TableHead, TableRow, TableCell, TableBody, } from '@mui/material'; import { useSelector } from 'react-redux'; -import { formatDate } from '../common/util/formatter'; +import { formatTime } from '../common/util/formatter'; import ReportFilter from './components/ReportFilter'; import { prefixString } from '../common/util/stringUtils'; import { useTranslation } from '../common/components/LocalizationProvider'; @@ -75,7 +75,7 @@ const EventReportPage = () => { const formatValue = (item, key) => { switch (key) { case 'eventTime': - return formatDate(item[key]); + return formatTime(item[key]); case 'type': return t(prefixString('event', item[key])); case 'geofenceId': diff --git a/modern/src/reports/StatisticsPage.js b/modern/src/reports/StatisticsPage.js index 41b8925d..2f839043 100644 --- a/modern/src/reports/StatisticsPage.js +++ b/modern/src/reports/StatisticsPage.js @@ -2,7 +2,7 @@ import React, { useState } from 'react'; import { Table, TableRow, TableCell, TableHead, TableBody, } from '@mui/material'; -import { formatDate } from '../common/util/formatter'; +import { formatTime } from '../common/util/formatter'; import { useTranslation } from '../common/components/LocalizationProvider'; import PageLayout from '../common/components/PageLayout'; import ReportsMenu from './components/ReportsMenu'; @@ -61,7 +61,7 @@ const StatisticsPage = () => { <TableRow key={item.id}> {columns.map((key) => ( <TableCell key={key}> - {key === 'captureTime' ? formatDate(item[key]) : item[key]} + {key === 'captureTime' ? formatTime(item[key], 'YYYY-MM-DD') : item[key]} </TableCell> ))} </TableRow> diff --git a/modern/src/reports/StopReportPage.js b/modern/src/reports/StopReportPage.js index 00c8a41b..c5bb1003 100644 --- a/modern/src/reports/StopReportPage.js +++ b/modern/src/reports/StopReportPage.js @@ -6,7 +6,7 @@ import { import GpsFixedIcon from '@mui/icons-material/GpsFixed'; import LocationSearchingIcon from '@mui/icons-material/LocationSearching'; import { - formatDistance, formatHours, formatDate, formatVolume, + formatDistance, formatHours, formatVolume, formatTime, } from '../common/util/formatter'; import ReportFilter from './components/ReportFilter'; import { useAttributePreference } from '../common/util/preferences'; @@ -64,7 +64,7 @@ const StopReportPage = () => { switch (key) { case 'startTime': case 'endTime': - return formatDate(item[key]); + return formatTime(item[key], 'YYYY-MM-DD HH:mm'); case 'startOdometer': return formatDistance(item[key], distanceUnit, t); case 'duration': diff --git a/modern/src/reports/SummaryReportPage.js b/modern/src/reports/SummaryReportPage.js index ca18b828..233bfe98 100644 --- a/modern/src/reports/SummaryReportPage.js +++ b/modern/src/reports/SummaryReportPage.js @@ -4,7 +4,7 @@ import { FormControl, InputLabel, Select, MenuItem, Table, TableHead, TableRow, TableBody, TableCell, } from '@mui/material'; import { - formatDistance, formatHours, formatDate, formatSpeed, formatVolume, + formatDistance, formatHours, formatSpeed, formatVolume, formatTime, } from '../common/util/formatter'; import ReportFilter from './components/ReportFilter'; import { useAttributePreference } from '../common/util/preferences'; @@ -67,7 +67,7 @@ const SummaryReportPage = () => { case 'deviceId': return devices[item[key]].name; case 'startTime': - return item[key] ? formatDate(item[key], 'YYYY-MM-DD') : null; + return item[key] ? formatTime(item[key], 'YYYY-MM-DD') : null; case 'startOdometer': case 'endOdometer': case 'distance': diff --git a/modern/src/reports/TripReportPage.js b/modern/src/reports/TripReportPage.js index 28ec8cc9..16bd3b00 100644 --- a/modern/src/reports/TripReportPage.js +++ b/modern/src/reports/TripReportPage.js @@ -5,7 +5,7 @@ import { import GpsFixedIcon from '@mui/icons-material/GpsFixed'; import LocationSearchingIcon from '@mui/icons-material/LocationSearching'; import { - formatDistance, formatSpeed, formatHours, formatDate, formatVolume, + formatDistance, formatSpeed, formatHours, formatVolume, formatTime, } from '../common/util/formatter'; import ReportFilter from './components/ReportFilter'; import { useAttributePreference } from '../common/util/preferences'; @@ -89,7 +89,7 @@ const TripReportPage = () => { switch (key) { case 'startTime': case 'endTime': - return formatDate(item[key]); + return formatTime(item[key], 'YYYY-MM-DD HH:mm'); case 'startOdometer': case 'endOdometer': case 'distance': |