From 535a7d2f2d3f92235f1ddf5c5cebd9671a01b272 Mon Sep 17 00:00:00 2001 From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Mon, 5 Dec 2022 09:41:19 -0800 Subject: [PATCH] Add optional tz --- src/pages/api/widgets/openmeteo.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/api/widgets/openmeteo.js b/src/pages/api/widgets/openmeteo.js index e79931cb6..372336451 100644 --- a/src/pages/api/widgets/openmeteo.js +++ b/src/pages/api/widgets/openmeteo.js @@ -1,8 +1,9 @@ import cachedFetch from "utils/proxy/cached-fetch"; export default async function handler(req, res) { - const { latitude, longitude, units, cache } = req.query; + const { latitude, longitude, units, cache, timezone } = req.query; const degrees = units === "imperial" ? "fahrenheit" : "celsius"; - const apiUrl = `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}&daily=sunrise,sunset¤t_weather=true&temperature_unit=${degrees}&timezone=auto`; + 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)); } \ No newline at end of file