summaryrefslogtreecommitdiff
path: root/searx/weather.py
diff options
context:
space:
mode:
authorBnyro <bnyro@tutanota.com>2025-04-26 22:21:39 +0200
committerBnyro <bnyro@tutanota.com>2025-08-28 10:49:50 +0200
commit5ca08c18134123fd5f9a457829090410221a93ce (patch)
tree73cb50a69230bd6ed61b467d31e85191022e9815 /searx/weather.py
parent90e602b349461f4a79bbe93e10bca4059e9d1721 (diff)
[feat] plugins: add new time/timezone search plugin
The plugin uses the ``GeoLocation`` class, which is already implemented in the context of weather forecasts, to determine the time zone. The ``DateTime`` class is used for the localized display of date and time. Co-authored-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/weather.py')
-rw-r--r--searx/weather.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/searx/weather.py b/searx/weather.py
index 793dc09c4..cb10181a0 100644
--- a/searx/weather.py
+++ b/searx/weather.py
@@ -20,6 +20,7 @@ import typing
import base64
import datetime
import dataclasses
+import zoneinfo
from urllib.parse import quote_plus
@@ -137,6 +138,10 @@ class GeoLocation:
country_code: str # 2-Character ISO-3166-1 alpha2 country code. E.g. DE for Germany
timezone: str # Time zone using time zone database definitions
+ @property
+ def zoneinfo(self) -> zoneinfo.ZoneInfo:
+ return zoneinfo.ZoneInfo(self.timezone)
+
def __str__(self):
return self.name