diff options
author | Ashutosh Bishnoi <mail2bishnoi@gmail.com> | 2021-02-10 12:13:13 +0530 |
---|---|---|
committer | Ashutosh Bishnoi <mail2bishnoi@gmail.com> | 2021-02-10 12:13:13 +0530 |
commit | 3e5ef37008fd009821181b1d539622a44b8cd745 (patch) | |
tree | 0f3452f76dea3f3e364988c1709c2dd59325095a /modern/src/common | |
parent | 240518c0fc8b5237557affe8e28b9b94ef46a081 (diff) | |
download | etbsa-traccar-web-3e5ef37008fd009821181b1d539622a44b8cd745.tar.gz etbsa-traccar-web-3e5ef37008fd009821181b1d539622a44b8cd745.tar.bz2 etbsa-traccar-web-3e5ef37008fd009821181b1d539622a44b8cd745.zip |
completed maintenance screen
Diffstat (limited to 'modern/src/common')
-rw-r--r-- | modern/src/common/converter.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modern/src/common/converter.js b/modern/src/common/converter.js index 8193e77..930dba1 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 |