From 3d10ccbdb13ef1d54d114e6df4fd2fdf75d9de20 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 20 Jul 2022 16:25:40 -0700 Subject: Better hours formatting --- modern/src/common/util/formatter.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'modern/src/common/util') 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; -- cgit v1.2.3