aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/common')
-rw-r--r--modern/src/common/converter.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/modern/src/common/converter.js b/modern/src/common/converter.js
index e48b076..8193e77 100644
--- a/modern/src/common/converter.js
+++ b/modern/src/common/converter.js
@@ -3,11 +3,29 @@ export const speedConverter = (value, unit) => {
switch (unit) {
case 'kmh':
factor = 1.852;
+ break;
case 'mph':
factor = 1.15078;
+ break;
case 'kn':
default:
factor = 1;
}
return (value * factor).toFixed(2);
};
+
+export const distanceConverter = (value, unit) => {
+ let factor;
+ switch (unit) {
+ case 'mi':
+ factor = 0.000621371;
+ break;
+ case 'nmi':
+ factor = 0.000539957;
+ break;
+ case 'km':
+ default:
+ factor = 0.001;
+ }
+ return (value * factor).toFixed(2);
+} \ No newline at end of file