aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common/converter.js
diff options
context:
space:
mode:
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