API & Client - add wind direction to workout detail - fix #134
This commit is contained in:
23
fittrackee_client/src/utils/weather.ts
Normal file
23
fittrackee_client/src/utils/weather.ts
Normal 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]
|
||||
}
|
Reference in New Issue
Block a user