aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common/formatter.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-04-17 17:56:11 -0700
committerAnton Tananaev <anton@traccar.org>2022-04-17 17:56:11 -0700
commitf31fe1395f778a3b61c783b7834b67bc2f26851c (patch)
tree51c9b59d1eb05f183775633d67bde7a42ab43fe2 /modern/src/common/formatter.js
parent9ff90e79d84bc09347697907d092cc4c7402715a (diff)
downloadtrackermap-web-f31fe1395f778a3b61c783b7834b67bc2f26851c.tar.gz
trackermap-web-f31fe1395f778a3b61c783b7834b67bc2f26851c.tar.bz2
trackermap-web-f31fe1395f778a3b61c783b7834b67bc2f26851c.zip
Improve device list icons
Diffstat (limited to 'modern/src/common/formatter.js')
-rw-r--r--modern/src/common/formatter.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/modern/src/common/formatter.js b/modern/src/common/formatter.js
index 1d4806e8..2a7c9095 100644
--- a/modern/src/common/formatter.js
+++ b/modern/src/common/formatter.js
@@ -4,6 +4,8 @@ export const formatBoolean = (value, t) => (value ? t('sharedYes') : t('sharedNo
export const formatNumber = (value, precision = 1) => Number(value.toFixed(precision));
+export const formatPercentage = (value) => `${value}%`;
+
export const formatDate = (value, format = 'YYYY-MM-DD HH:mm') => moment(value).format(format);
export const formatTime = (value, format = 'YYYY-MM-DD HH:mm:ss') => moment(value).format(format);
@@ -24,7 +26,7 @@ export const formatPosition = (value, key, t) => {
case 'course':
return value.toFixed(1);
case 'batteryLevel':
- return `${value}%`;
+ return formatPercentage(value);
default:
if (typeof value === 'number') {
return formatNumber(value);
@@ -119,7 +121,7 @@ export const getBatteryStatus = (batteryLevel) => {
return 'positive';
}
if (batteryLevel > 30) {
- return 'neutral';
+ return 'medium';
}
return 'negative';
};