modified: __pycache__/app.cpython-310.pyc
modified: app.py modified: static/css/style.css modified: templates/weather.html
This commit is contained in:
11
app.py
11
app.py
@@ -202,13 +202,17 @@ def wetter():
|
||||
|
||||
# "Aktuell" = erste Stunde >= jetzt (UTC), sonst erste verfügbare
|
||||
now_utc = _dt.datetime.now(_dt.timezone.utc).replace(tzinfo=None)
|
||||
current = forecast[0]
|
||||
for h in forecast:
|
||||
now_local = _dt.datetime.now() # lokale Serverzeit für Anzeige
|
||||
current_idx = 0
|
||||
for i, h in enumerate(forecast):
|
||||
dt = h["datetime"]
|
||||
dt_naive = dt.replace(tzinfo=None) if hasattr(dt, "tzinfo") and dt.tzinfo is not None else dt
|
||||
if dt_naive >= now_utc:
|
||||
current = h
|
||||
current_idx = i
|
||||
break
|
||||
current = forecast[current_idx]
|
||||
# Stundenliste ab jetzt kürzen
|
||||
forecast = forecast[current_idx:]
|
||||
|
||||
# Tageszusammenfassung
|
||||
daily = {}
|
||||
@@ -262,6 +266,7 @@ def wetter():
|
||||
station_id=station_id,
|
||||
station_dist=station_dist,
|
||||
current=current,
|
||||
now_local=now_local.strftime("%H:%M"),
|
||||
forecast=forecast[:48],
|
||||
daily=daily_summary,
|
||||
chart_labels=chart_labels,
|
||||
|
||||
Reference in New Issue
Block a user