'datetime.date' object has no attribute 'date'
kevnoli opened this issue · 1 comments
kevnoli commented
I'm building an API with FastAPI that connects to a Firebird 3.0.4 database.
For an endpoint that accepts a model with a date field and tries to update a table with that date, I'm getting the following error message:
File "[...]/site-packages/firebird/driver/core.py", line 179, in _encode_timestamp
return _util.encode_date(v.date()).to_bytes(4, 'little') + _util.encode_time(datetime.time()).to_bytes(4, 'little')
AttributeError: 'datetime.date' object has no attribute 'date'
I believe that this code could be fixed by removing the call to date()
if isinstance(v, datetime.date):
return _util.encode_date(v).to_bytes(4, 'little') + _util.encode_time(datetime.time()).to_bytes(4, 'little')
raise ValueError("datetime.datetime or datetime.date expected")
pcisar commented
Fixed. Thanks for your report.