aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common/util
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-07-20 16:25:40 -0700
committerAnton Tananaev <anton@traccar.org>2022-07-20 16:25:40 -0700
commit3d10ccbdb13ef1d54d114e6df4fd2fdf75d9de20 (patch)
treed063cb9ae37d3b939f9731d1ae44557c90bb3d73 /modern/src/common/util
parent29365a7bf12331ecee5f53eca83cf141a2e8d1f9 (diff)
downloadtrackermap-web-3d10ccbdb13ef1d54d114e6df4fd2fdf75d9de20.tar.gz
trackermap-web-3d10ccbdb13ef1d54d114e6df4fd2fdf75d9de20.tar.bz2
trackermap-web-3d10ccbdb13ef1d54d114e6df4fd2fdf75d9de20.zip
Better hours formatting
Diffstat (limited to 'modern/src/common/util')
-rw-r--r--modern/src/common/util/formatter.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/modern/src/common/util/formatter.js b/modern/src/common/util/formatter.js
index f36b4d38..47bd2cd0 100644
--- a/modern/src/common/util/formatter.js
+++ b/modern/src/common/util/formatter.js
@@ -41,6 +41,12 @@ export const formatVolume = (value, unit, t) => `${volumeFromLiters(value, unit)
export const formatHours = (value) => moment.duration(value).humanize();
+export const formatNumericHours = (value, t) => {
+ const hours = Math.floor(value / 3600000);
+ const minutes = Math.floor((value % 3600000) / 60000);
+ return `${hours} ${t('sharedHourAbbreviation')} ${minutes} ${t('sharedMinuteAbbreviation')}`;
+};
+
export const formatCoordinate = (key, value, unit) => {
let hemisphere;
let degrees;