aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common/converter.js
diff options
context:
space:
mode:
authorAshutosh Bishnoi <mail2bishnoi@gmail.com>2021-02-10 12:13:13 +0530
committerAshutosh Bishnoi <mail2bishnoi@gmail.com>2021-02-10 12:13:13 +0530
commit3e5ef37008fd009821181b1d539622a44b8cd745 (patch)
tree0f3452f76dea3f3e364988c1709c2dd59325095a /modern/src/common/converter.js
parent240518c0fc8b5237557affe8e28b9b94ef46a081 (diff)
downloadtrackermap-web-3e5ef37008fd009821181b1d539622a44b8cd745.tar.gz
trackermap-web-3e5ef37008fd009821181b1d539622a44b8cd745.tar.bz2
trackermap-web-3e5ef37008fd009821181b1d539622a44b8cd745.zip
completed maintenance screen
Diffstat (limited to 'modern/src/common/converter.js')
-rw-r--r--modern/src/common/converter.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/modern/src/common/converter.js b/modern/src/common/converter.js
index 8193e77f..930dba15 100644
--- a/modern/src/common/converter.js
+++ b/modern/src/common/converter.js
@@ -1,4 +1,4 @@
-export const speedConverter = (value, unit) => {
+export const speedConverter = (value, unit, back = false) => {
let factor;
switch (unit) {
case 'kmh':
@@ -11,10 +11,10 @@ export const speedConverter = (value, unit) => {
default:
factor = 1;
}
- return (value * factor).toFixed(2);
+ return back ? (value / factor).toFixed(2):(value * factor).toFixed(2);
};
-export const distanceConverter = (value, unit) => {
+export const distanceConverter = (value, unit, back = false) => {
let factor;
switch (unit) {
case 'mi':
@@ -27,5 +27,5 @@ export const distanceConverter = (value, unit) => {
default:
factor = 0.001;
}
- return (value * factor).toFixed(2);
+ return back ? value / factor : value * factor;
} \ No newline at end of file