You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As mentioned on Slack earlier today, I have a Person model that is defined with a date column (not datetime). When trying to retrieve it with a query like users = User.with_("person", "name", "roles").order_by('last_active_at', 'desc').get() it throws an exception in Pendulum "instance() only accepts datetime objects." (I suspect it would do this even when querying the Person directly, but I haven't tried.)
The model has the date of birth (DOB) column indicated as a date type:
For columns that are defined as date or datetime in the database, I haven't found it necessary to specify __dates__ in the model, but I tried it here anyway. Perhaps I'm misunderstanding what this does or when it is needed. I suspect it is mainly for fields that are strings/char types holding date information.
What database are you using?
Type: MySQL
Masonite ORM v1.0.48
Additional context
It looks like date types need to be handled in the get_new_date method before this line
Joseph mentioned the pendulum issue #250 which seems to be the problem. This could be fixed in either the Masonite ORM Model or in pendulum.
Querying and using this date column was working fine with Masonite 2 using Orator ORM. (I am working on migrating the code to Masonite 3.) I believe Orator handled the date types before it did its "hydration" step. Perhaps it would be worthwhile to look at what it did.
The text was updated successfully, but these errors were encountered:
tpow
added
the
bug
An existing feature is not working as intended
label
Jun 9, 2021
As mentioned on Slack earlier today, I have a Person model that is defined with a date column (not datetime). When trying to retrieve it with a query like
users = User.with_("person", "name", "roles").order_by('last_active_at', 'desc').get()
it throws an exception in Pendulum "instance() only accepts datetime objects." (I suspect it would do this even when querying the Person directly, but I haven't tried.)The model has the date of birth (DOB) column indicated as a date type:
For columns that are defined as date or datetime in the database, I haven't found it necessary to specify
__dates__
in the model, but I tried it here anyway. Perhaps I'm misunderstanding what this does or when it is needed. I suspect it is mainly for fields that are strings/char types holding date information.What database are you using?
Additional context
It looks like date types need to be handled in the get_new_date method before this line
orm/src/masoniteorm/models/Model.py
Line 734 in 0354e62
Joseph mentioned the pendulum issue #250 which seems to be the problem. This could be fixed in either the Masonite ORM Model or in pendulum.
Querying and using this date column was working fine with Masonite 2 using Orator ORM. (I am working on migrating the code to Masonite 3.) I believe Orator handled the date types before it did its "hydration" step. Perhaps it would be worthwhile to look at what it did.
The text was updated successfully, but these errors were encountered: