-
Notifications
You must be signed in to change notification settings - Fork 802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dates get casted to datetimes on retrieved objects, causing parsing errors during updates #1913
Comments
Okay, yes, I can confirm that this is a bug introduced with the typing support. Looking into this. Update: it's actually not a typing bug, you have stumbled upon something that has been broken for a very long time. I went as far back as version 7.4.1 and this bug is still there. |
Thanks for the quick turnaround! I can confirm 8.15.3 has fixed the bug and I was able to discontinue the use of a workaround helper method that just re-casted datetimes back to dates. |
I have the following document class, along with a helper method that adapts objects from our existing SQL database:
When I save
IdCard
objects to the database, it behaves how I would expect:However, when I go to retrieve the person via the DSL class, the dates get casted into datetime objects:
As a result, unless I manually re-cast the date fields to date, modifying the person and calling
.save()
throws an exception:According to the type mapping documentation, this would seem to be an error. If anything, I would expect the reverse to occur (casting datetimes into dates) based on the type mapping table.
Is casting dates to datetimes the expected behavior? If so, should I be using a different type hint for dates that will never have times?
Edit: If I execute a search, the fields remain dates until they get converted into the DSL class:
The text was updated successfully, but these errors were encountered: