Fix wrong calculation for converting celsius to fahrenheit

This commit is contained in:
SileNce5k 2024-10-04 03:56:31 +02:00
parent 6ee51970fc
commit eee9539ac2
Signed by: SileNce
GPG key ID: B0A142BB4291B204

View file

@ -14,7 +14,7 @@ module.exports = {
switch (args[1].toUpperCase()) { switch (args[1].toUpperCase()) {
case "C": case "C":
if (args[2].toUpperCase() === "F") { if (args[2].toUpperCase() === "F") {
const fahrenheit = ((parseFloat(args[0]) * 5 / 9) + 32).toFixed(2); const fahrenheit = ((parseFloat(args[0]) * 9 / 5) + 32).toFixed(2);
sendText = `${args[0]}°C is ${fahrenheit}°F`; sendText = `${args[0]}°C is ${fahrenheit}°F`;
} else { } else {
sendText = "Can only convert to celsius from fahrenheit"; sendText = "Can only convert to celsius from fahrenheit";