This repository was archived by the owner on Aug 10, 2022. It is now read-only.
File tree 1 file changed +8
-4
lines changed 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,10 @@ export default class WeatherCommand extends GeneralCommand {
38
38
return Math . round ( ( ( degree - 32 ) * 5 ) / 9 ) ;
39
39
}
40
40
41
+ toKph ( mph : number ) {
42
+ return ( mph * 1.609 ) . toFixed ( 2 ) ;
43
+ }
44
+
41
45
getCardinal ( angle : number ) {
42
46
const degreePerDirection = 360 / 8 ;
43
47
const offsetAngle = angle + degreePerDirection / 2 ;
@@ -78,10 +82,10 @@ export default class WeatherCommand extends GeneralCommand {
78
82
**Temperature**: ${ temperature } °F (${ this . toCelsius ( temperature ) } °C)
79
83
Apparent Temperature: ${ apparentTemperature } °F (${ this . toCelsius ( apparentTemperature ) } °C)
80
84
**Humidity:** ${ weather . currently . humidity * 100 } %
81
- **Wind Speed:** ${ weather . currently . windSpeed } mph (${
82
- weather . currently . windSpeed * 1.609
83
- } kph) ${ this . getCardinal ( weather . currently . windBearing ) }
84
- Wind Gust Speed: ${ weather . currently . windGust } mph (${ weather . currently . windGust * 1.609 } kph)
85
+ **Wind Speed:** ${ weather . currently . windSpeed } mph (${ this . toKph (
86
+ weather . currently . windSpeed
87
+ ) } kph) ${ this . getCardinal ( weather . currently . windBearing ) }
88
+ Wind Gust Speed: ${ weather . currently . windGust } mph (${ this . toKph ( weather . currently . windGust ) } kph)
85
89
${
86
90
weather . currently . nearestStormDistance
87
91
? `Nearest Storm: ${ weather . currently . nearestStormDistance } mi ${ this . getCardinal (
You can’t perform that action at this time.
0 commit comments