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:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user