From 2ef17f32bf99e4e823ad3622227a8f41af798d65 Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Fri, 13 Nov 2020 12:49:51 +0530 Subject: Implementing Stops Report --- modern/src/common/formatter.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'modern/src/common') diff --git a/modern/src/common/formatter.js b/modern/src/common/formatter.js index 52c05c0..7221618 100644 --- a/modern/src/common/formatter.js +++ b/modern/src/common/formatter.js @@ -67,6 +67,18 @@ export const formatSpeed = (value, unit) => { } }; +export const formatVolume = (value, unit) => { + switch (unit) { + case 'impGal': + return `${(value / 4.546).toFixed(2)} ${t('sharedGallonAbbreviation')}`; + case 'usGal': + return `${(value / 3.785).toFixed(2)} ${t('sharedGallonAbbreviation')}`; + case 'ltr': + default: + return `${(value / 1).toFixed(2)} ${t('sharedLiterAbbreviation')}`; + } +} + export const formatHours = (value) => { return moment.duration(value).humanize(); }; -- cgit v1.2.3