Skip to content

Commit 804d997

Browse files
committed
fix(api): return forecast timestamps as explicit UTC (Z suffix)
MariaDB stores forecast times as naive UTC; ensure /api/forecast emits ISO-8601 with Z so time-axis charts plot forecast points at the correct instant alongside local-time history data.
1 parent 3dd34cd commit 804d997

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎api/__init__.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,9 @@ def api_forecast(
469469

470470
data = [
471471
{
472-
"ts": ts.isoformat() if ts else None,
472+
# MariaDB stores UTC naive datetimes; append Z so clients
473+
# interpret them as UTC (consistent with ISO-8601).
474+
"ts": ts.replace(tzinfo=timezone.utc).isoformat() if ts else None,
473475
"predicted_watts": float(predicted_watts),
474476
"cloud_cover": float(cloud_cover) if cloud_cover is not None else None,
475477
"source": source,

0 commit comments

Comments
 (0)