API & Client - add wind direction to workout detail - fix #134

This commit is contained in:
Sam
2022-01-15 21:54:37 +01:00
parent 7e2d123cdc
commit 5725a574bd
21 changed files with 165 additions and 30 deletions

View File

@ -0,0 +1,23 @@
const directions = [
'N',
'NNE',
'NE',
'ENE',
'E',
'ESE',
'SE',
'SSE',
'S',
'SSW',
'SW',
'WSW',
'W',
'WNW',
'NW',
'NNW',
]
export const convertDegreeToDirection = (angle: number): string => {
const value = Math.floor(angle / 22.5 + 0.5)
return directions[value % 16]
}