aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common
diff options
context:
space:
mode:
authorAshutosh Bishnoi <mail2bishnoi@gmail.com>2020-11-13 12:19:51 +0530
committerAshutosh Bishnoi <mail2bishnoi@gmail.com>2020-11-13 12:19:51 +0530
commit651dfa0ca0626a47c684077ab39feeade177a28d (patch)
tree050ad5109ac0eb6fc0386a1292eeb6a6e75057c4 /modern/src/common
parentd7bfb9ac6fabf09f4675ea58bc58e12dbd04eee9 (diff)
downloadtrackermap-web-651dfa0ca0626a47c684077ab39feeade177a28d.tar.gz
trackermap-web-651dfa0ca0626a47c684077ab39feeade177a28d.tar.bz2
trackermap-web-651dfa0ca0626a47c684077ab39feeade177a28d.zip
Minor bug fixes and improvements in Trips report
Diffstat (limited to 'modern/src/common')
-rw-r--r--modern/src/common/formatter.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/modern/src/common/formatter.js b/modern/src/common/formatter.js
index 6705221a..52c05c0d 100644
--- a/modern/src/common/formatter.js
+++ b/modern/src/common/formatter.js
@@ -39,6 +39,10 @@ export const formatNumber = (value, precision = 1) => {
return Number(value.toFixed(precision));
};
+export const formatDate = (value, format = 'YYYY-MM-DD HH:mm') => {
+ return moment(value).format(format);
+};
+
export const formatDistance = (value, unit) => {
switch (unit) {
case 'mi':
@@ -64,9 +68,5 @@ export const formatSpeed = (value, unit) => {
};
export const formatHours = (value) => {
- let hours, minutes;
- hours = Math.floor(value / 3600000);
- minutes = Math.floor(value % 3600000 / 60000);
-
- return `${hours} ${t('sharedHourAbbreviation')} ${minutes} ${t('sharedMinuteAbbreviation')}`;
+ return moment.duration(value).humanize();
};