aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common/formatter.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-01 17:33:14 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-01 17:33:14 -0700
commit336c00ac843da828728be7c5e1333d176f41fe51 (patch)
treed4bb0efda1f85343786ac3ecf123d591d06571e6 /modern/src/common/formatter.js
parent59ee36bb64ce6c4b7ea7e10f68b8b1f927af4f7d (diff)
downloadtrackermap-web-336c00ac843da828728be7c5e1333d176f41fe51.tar.gz
trackermap-web-336c00ac843da828728be7c5e1333d176f41fe51.tar.bz2
trackermap-web-336c00ac843da828728be7c5e1333d176f41fe51.zip
Proper course formatting
Diffstat (limited to 'modern/src/common/formatter.js')
-rw-r--r--modern/src/common/formatter.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/modern/src/common/formatter.js b/modern/src/common/formatter.js
index 6968deb7..fed29a9d 100644
--- a/modern/src/common/formatter.js
+++ b/modern/src/common/formatter.js
@@ -43,6 +43,11 @@ export const formatPosition = (value, key, t) => {
}
};
+export const formatCourse = (value) => {
+ const courseValues = ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'];
+ return courseValues[Math.floor(value / 45)];
+};
+
export const formatDistance = (value, unit, t) => {
switch (unit) {
case 'mi':