Fix incorrect timezone assignment in event_date validator

Updated the validation logic to correctly replace the timezone for `event_date`. This ensures proper handling of datetime objects without tzinfo.
This commit is contained in:
2025-03-14 03:09:31 +01:00
parent 74d37fc54c
commit b18f684afb

View File

@@ -84,7 +84,7 @@ class EventResponse(EventInDBBase):
@field_validator('event_date')
def validate_datetime(cls, v):
if v.tzinfo is None:
v.event_date = v.event_date.replace(tzinfo=timezone.utc)
v = v.replace(tzinfo=timezone.utc)
return v