diff options
Diffstat (limited to 'modern/src/reports')
-rw-r--r-- | modern/src/reports/ChartReportPage.js | 5 | ||||
-rw-r--r-- | modern/src/reports/EventReportPage.js | 5 | ||||
-rw-r--r-- | modern/src/reports/StatisticsPage.js | 5 | ||||
-rw-r--r-- | modern/src/reports/StopReportPage.js | 5 | ||||
-rw-r--r-- | modern/src/reports/SummaryReportPage.js | 5 | ||||
-rw-r--r-- | modern/src/reports/TripReportPage.js | 5 |
6 files changed, 19 insertions, 11 deletions
diff --git a/modern/src/reports/ChartReportPage.js b/modern/src/reports/ChartReportPage.js index 4605a5b9..3a4aeb4f 100644 --- a/modern/src/reports/ChartReportPage.js +++ b/modern/src/reports/ChartReportPage.js @@ -12,7 +12,7 @@ import PageLayout from '../common/components/PageLayout'; import ReportsMenu from './components/ReportsMenu'; import usePositionAttributes from '../common/attributes/usePositionAttributes'; import { useCatch } from '../reactHelper'; -import { useAttributePreference } from '../common/util/preferences'; +import { useAttributePreference, usePreference } from '../common/util/preferences'; import { altitudeFromMeters, distanceFromMeters, speedFromKnots, volumeFromLiters, } from '../common/util/converter'; @@ -28,6 +28,7 @@ const ChartReportPage = () => { const altitudeUnit = useAttributePreference('altitudeUnit'); const speedUnit = useAttributePreference('speedUnit'); const volumeUnit = useAttributePreference('volumeUnit'); + const hours12 = usePreference('twelveHourFormat'); const [items, setItems] = useState([]); const [type, setType] = useState('speed'); @@ -47,7 +48,7 @@ const ChartReportPage = () => { const formattedPositions = positions.map((position) => { const data = { ...position, ...position.attributes }; const formatted = {}; - formatted.fixTime = formatTime(position.fixTime, 'HH:mm:ss'); + formatted.fixTime = formatTime(position.fixTime, 'time', hours12); 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 ce1772e4..67bbd888 100644 --- a/modern/src/reports/EventReportPage.js +++ b/modern/src/reports/EventReportPage.js @@ -16,7 +16,7 @@ import ColumnSelect from './components/ColumnSelect'; import { useCatch, useEffectAsync } from '../reactHelper'; import useReportStyles from './common/useReportStyles'; import TableShimmer from '../common/components/TableShimmer'; -import { useAttributePreference } from '../common/util/preferences'; +import { useAttributePreference, usePreference } from '../common/util/preferences'; import MapView from '../map/core/MapView'; import MapGeofence from '../map/MapGeofence'; import MapPositions from '../map/MapPositions'; @@ -39,6 +39,7 @@ const EventReportPage = () => { const geofences = useSelector((state) => state.geofences.items); const speedUnit = useAttributePreference('speedUnit'); + const hours12 = usePreference('twelveHourFormat'); const [allEventTypes, setAllEventTypes] = useState([['allEvents', 'eventAll']]); @@ -105,7 +106,7 @@ const EventReportPage = () => { const formatValue = (item, key) => { switch (key) { case 'eventTime': - return formatTime(item[key]); + return formatTime(item[key], 'seconds', hours12); 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 254a912d..7b3f2879 100644 --- a/modern/src/reports/StatisticsPage.js +++ b/modern/src/reports/StatisticsPage.js @@ -12,6 +12,7 @@ import ColumnSelect from './components/ColumnSelect'; import { useCatch } from '../reactHelper'; import useReportStyles from './common/useReportStyles'; import TableShimmer from '../common/components/TableShimmer'; +import { usePreference } from '../common/util/preferences'; const columnsArray = [ ['captureTime', 'statisticsCaptureTime'], @@ -31,6 +32,8 @@ const StatisticsPage = () => { const classes = useReportStyles(); const t = useTranslation(); + const hours12 = usePreference('twelveHourFormat'); + const [columns, setColumns] = usePersistedState('statisticsColumns', ['captureTime', 'activeUsers', 'activeDevices', 'messagesStored']); const [items, setItems] = useState([]); const [loading, setLoading] = useState(false); @@ -68,7 +71,7 @@ const StatisticsPage = () => { <TableRow key={item.id}> {columns.map((key) => ( <TableCell key={key}> - {key === 'captureTime' ? formatTime(item[key], 'YYYY-MM-DD') : item[key]} + {key === 'captureTime' ? formatTime(item[key], 'date', hours12) : item[key]} </TableCell> ))} </TableRow> diff --git a/modern/src/reports/StopReportPage.js b/modern/src/reports/StopReportPage.js index a322304e..ce790401 100644 --- a/modern/src/reports/StopReportPage.js +++ b/modern/src/reports/StopReportPage.js @@ -9,7 +9,7 @@ import { formatDistance, formatHours, formatVolume, formatTime, } from '../common/util/formatter'; import ReportFilter from './components/ReportFilter'; -import { useAttributePreference } from '../common/util/preferences'; +import { useAttributePreference, usePreference } from '../common/util/preferences'; import { useTranslation } from '../common/components/LocalizationProvider'; import PageLayout from '../common/components/PageLayout'; import ReportsMenu from './components/ReportsMenu'; @@ -41,6 +41,7 @@ const StopReportPage = () => { const distanceUnit = useAttributePreference('distanceUnit'); const volumeUnit = useAttributePreference('volumeUnit'); + const hours12 = usePreference('twelveHourFormat'); const [columns, setColumns] = usePersistedState('stopColumns', ['startTime', 'endTime', 'startOdometer', 'address']); const [items, setItems] = useState([]); @@ -77,7 +78,7 @@ const StopReportPage = () => { switch (key) { case 'startTime': case 'endTime': - return formatTime(item[key], 'YYYY-MM-DD HH:mm'); + return formatTime(item[key], 'minutes', hours12); 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 f8216155..d66d58c6 100644 --- a/modern/src/reports/SummaryReportPage.js +++ b/modern/src/reports/SummaryReportPage.js @@ -7,7 +7,7 @@ import { formatDistance, formatHours, formatSpeed, formatVolume, formatTime, } from '../common/util/formatter'; import ReportFilter from './components/ReportFilter'; -import { useAttributePreference } from '../common/util/preferences'; +import { useAttributePreference, usePreference } from '../common/util/preferences'; import { useTranslation } from '../common/components/LocalizationProvider'; import PageLayout from '../common/components/PageLayout'; import ReportsMenu from './components/ReportsMenu'; @@ -38,6 +38,7 @@ const SummaryReportPage = () => { const distanceUnit = useAttributePreference('distanceUnit'); const speedUnit = useAttributePreference('speedUnit'); const volumeUnit = useAttributePreference('volumeUnit'); + const hours12 = usePreference('twelveHourFormat'); const [columns, setColumns] = usePersistedState('summaryColumns', ['startTime', 'distance', 'averageSpeed']); const [daily, setDaily] = useState(false); @@ -77,7 +78,7 @@ const SummaryReportPage = () => { case 'deviceId': return devices[item[key]].name; case 'startTime': - return item[key] ? formatTime(item[key], 'YYYY-MM-DD') : null; + return formatTime(item[key], 'date', hours12); case 'startOdometer': case 'endOdometer': case 'distance': diff --git a/modern/src/reports/TripReportPage.js b/modern/src/reports/TripReportPage.js index 63988850..ffe16241 100644 --- a/modern/src/reports/TripReportPage.js +++ b/modern/src/reports/TripReportPage.js @@ -8,7 +8,7 @@ import { formatDistance, formatSpeed, formatHours, formatVolume, formatTime, } from '../common/util/formatter'; import ReportFilter from './components/ReportFilter'; -import { useAttributePreference } from '../common/util/preferences'; +import { useAttributePreference, usePreference } from '../common/util/preferences'; import { useTranslation } from '../common/components/LocalizationProvider'; import PageLayout from '../common/components/PageLayout'; import ReportsMenu from './components/ReportsMenu'; @@ -47,6 +47,7 @@ const TripReportPage = () => { const distanceUnit = useAttributePreference('distanceUnit'); const speedUnit = useAttributePreference('speedUnit'); const volumeUnit = useAttributePreference('volumeUnit'); + const hours12 = usePreference('twelveHourFormat'); const [columns, setColumns] = usePersistedState('tripColumns', ['startTime', 'endTime', 'distance', 'averageSpeed']); const [items, setItems] = useState([]); @@ -119,7 +120,7 @@ const TripReportPage = () => { switch (key) { case 'startTime': case 'endTime': - return formatTime(item[key], 'YYYY-MM-DD HH:mm'); + return formatTime(item[key], 'minutes', hours12); case 'startOdometer': case 'endOdometer': case 'distance': |