[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>
This commit is contained in:
Bnyro
2025-04-26 22:21:39 +02:00
parent 90e602b349
commit 5ca08c1813
5 changed files with 87 additions and 0 deletions
+5
View File
@@ -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