mirror of
https://github.com/searxng/searxng.git
synced 2026-06-01 23:47:16 +02:00
[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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user