Assume I have a pydantic model
class EventEditRequest(BaseModel):
uid: UUID
name: str
start_dt: datetime
end_dt: datetime
I send request with body b'{"uid":"a38a7543-20ca-4a50-ab4e-e6a3ae379d3c","name":"test event2222","start_dt":1600414328,"end_dt":1600450327}'
So both start_dt
and end_dt
are unix timestamps. But in endpoint they become datetimes with timezones.
@app.put('...')
def edit_event(event_data: EventEditRequest):
event_data.start_dt.tzinfo is not None # True
I don't want to manually edit start_dt
and end_dt
in the endpoint function to get rid of timezones. How can I set up my pydantic model so it will make datetime without timezones?