aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common/formatter.js
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/common/formatter.js')
-rw-r--r--modern/src/common/formatter.js12
1 files changed, 12 insertions, 0 deletions
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();
};