diff options
author | Anton Tananaev <anton@traccar.org> | 2024-02-19 07:17:41 -0800 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2024-02-19 07:17:41 -0800 |
commit | 32302e6bc54a65b9594d4cde4ff4c8983f97dacc (patch) | |
tree | d727397e591376e11d1aa7d63da1ee0ca259164d /modern | |
parent | d25a7b433f3dbc69020380b14d283b1ee73f420e (diff) | |
download | trackermap-web-32302e6bc54a65b9594d4cde4ff4c8983f97dacc.tar.gz trackermap-web-32302e6bc54a65b9594d4cde4ff4c8983f97dacc.tar.bz2 trackermap-web-32302e6bc54a65b9594d4cde4ff4c8983f97dacc.zip |
Update duration formatting
Diffstat (limited to 'modern')
-rw-r--r-- | modern/src/common/util/formatter.js | 2 | ||||
-rw-r--r-- | modern/src/reports/StopReportPage.jsx | 6 | ||||
-rw-r--r-- | modern/src/reports/SummaryReportPage.jsx | 4 | ||||
-rw-r--r-- | modern/src/reports/TripReportPage.jsx | 4 |
4 files changed, 7 insertions, 9 deletions
diff --git a/modern/src/common/util/formatter.js b/modern/src/common/util/formatter.js index aeacc145..7b7fc96d 100644 --- a/modern/src/common/util/formatter.js +++ b/modern/src/common/util/formatter.js @@ -66,8 +66,6 @@ export const formatSpeed = (value, unit, t) => `${speedFromKnots(value, unit).to export const formatVolume = (value, unit, t) => `${volumeFromLiters(value, unit).toFixed(2)} ${volumeUnitString(unit, t)}`; -export const formatHours = (value) => dayjs.duration(value).humanize(); - export const formatNumericHours = (value, t) => { const hours = Math.floor(value / 3600000); const minutes = Math.floor((value % 3600000) / 60000); diff --git a/modern/src/reports/StopReportPage.jsx b/modern/src/reports/StopReportPage.jsx index 3a6ee18d..066b29a4 100644 --- a/modern/src/reports/StopReportPage.jsx +++ b/modern/src/reports/StopReportPage.jsx @@ -7,7 +7,7 @@ import { import GpsFixedIcon from '@mui/icons-material/GpsFixed'; import LocationSearchingIcon from '@mui/icons-material/LocationSearching'; import { - formatDistance, formatHours, formatVolume, formatTime, + formatDistance, formatVolume, formatTime, formatNumericHours, } from '../common/util/formatter'; import ReportFilter from './components/ReportFilter'; import { useAttributePreference, usePreference } from '../common/util/preferences'; @@ -95,9 +95,9 @@ const StopReportPage = () => { case 'startOdometer': return formatDistance(item[key], distanceUnit, t); case 'duration': - return formatHours(item[key]); + return formatNumericHours(item[key], t); case 'engineHours': - return formatHours(item[key]); + return formatNumericHours(item[key], t); case 'spentFuel': return formatVolume(item[key], volumeUnit, t); case 'address': diff --git a/modern/src/reports/SummaryReportPage.jsx b/modern/src/reports/SummaryReportPage.jsx index ec5395f1..ae7e043e 100644 --- a/modern/src/reports/SummaryReportPage.jsx +++ b/modern/src/reports/SummaryReportPage.jsx @@ -5,7 +5,7 @@ import { FormControl, InputLabel, Select, MenuItem, Table, TableHead, TableRow, TableBody, TableCell, } from '@mui/material'; import { - formatDistance, formatHours, formatSpeed, formatVolume, formatTime, + formatDistance, formatSpeed, formatVolume, formatTime, formatNumericHours, } from '../common/util/formatter'; import ReportFilter from './components/ReportFilter'; import { useAttributePreference, usePreference } from '../common/util/preferences'; @@ -101,7 +101,7 @@ const SummaryReportPage = () => { case 'maxSpeed': return formatSpeed(item[key], speedUnit, t); case 'engineHours': - return formatHours(item[key]); + return formatNumericHours(item[key], t); case 'spentFuel': return formatVolume(item[key], volumeUnit, t); default: diff --git a/modern/src/reports/TripReportPage.jsx b/modern/src/reports/TripReportPage.jsx index f5b524ad..897ee506 100644 --- a/modern/src/reports/TripReportPage.jsx +++ b/modern/src/reports/TripReportPage.jsx @@ -6,7 +6,7 @@ import { import GpsFixedIcon from '@mui/icons-material/GpsFixed'; import LocationSearchingIcon from '@mui/icons-material/LocationSearching'; import { - formatDistance, formatSpeed, formatHours, formatVolume, formatTime, + formatDistance, formatSpeed, formatVolume, formatTime, formatNumericHours, } from '../common/util/formatter'; import ReportFilter from './components/ReportFilter'; import { useAttributePreference, usePreference } from '../common/util/preferences'; @@ -142,7 +142,7 @@ const TripReportPage = () => { case 'maxSpeed': return formatSpeed(item[key], speedUnit, t); case 'duration': - return formatHours(item[key]); + return formatNumericHours(item[key], t); case 'spentFuel': return formatVolume(item[key], volumeUnit, t); case 'startAddress': |