From 3736c1fcababba4ccb43e2c02aba1523d52b70a9 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Thu, 31 Oct 2024 12:20:08 -0700 Subject: [PATCH] Fix: use same unit default for openmeteo widget and api (#4227) --- src/pages/api/widgets/openmeteo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/api/widgets/openmeteo.js b/src/pages/api/widgets/openmeteo.js index b34938b1549..e63847b43bf 100644 --- a/src/pages/api/widgets/openmeteo.js +++ b/src/pages/api/widgets/openmeteo.js @@ -2,7 +2,7 @@ import cachedFetch from "utils/proxy/cached-fetch"; export default async function handler(req, res) { const { latitude, longitude, units, cache, timezone } = req.query; - const degrees = units === "imperial" ? "fahrenheit" : "celsius"; + const degrees = units === "metric" ? "celsius" : "fahrenheit"; const timezeone = timezone ?? "auto"; const apiUrl = `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}&daily=sunrise,sunset¤t_weather=true&temperature_unit=${degrees}&timezone=${timezeone}`; return res.send(await cachedFetch(apiUrl, cache));