From 5d661a1599c50435b33907720d8864ff475aecf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Benko?= Date: Mon, 30 Mar 2026 11:02:29 +0200 Subject: [PATCH] API: use UTC timestamps in set attr value endpoint The platform uses mostly UTC timestamps nowadays, and that also applies to the data ingested. However, datapoints created through "set attribute value" endpoint in the DP3 API still use timezone unaware timestamps. This patch allows unified data processing in the applications. --- dp3/api/routers/entity.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dp3/api/routers/entity.py b/dp3/api/routers/entity.py index 74433fdd..9b5988ff 100644 --- a/dp3/api/routers/entity.py +++ b/dp3/api/routers/entity.py @@ -1,4 +1,4 @@ -from datetime import datetime +from datetime import datetime, timezone from typing import Annotated, Any, Optional from fastapi import APIRouter, Depends, HTTPException, Request @@ -354,7 +354,7 @@ async def set_eid_attr_value( id=eid, attr=attr, v=body.value, - t1=datetime.now(), + t1=datetime.now(timezone.utc), src=f"{request.client.host} via API", ) dp3_dp = api_to_dp3_datapoint(dp.dict())