-
Notifications
You must be signed in to change notification settings - Fork 43
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
shared: add UTCDateTime column type #179
base: master
Are you sure you want to change the base?
shared: add UTCDateTime column type #179
Conversation
utnapischtim
commented
Dec 16, 2024
- with that it is possible to solve the datetime.utcnow DeprecationWarnings
f68b8cd
to
77dae3f
Compare
* with that it is possible to solve the datetime.utcnow DeprecationWarnings
77dae3f
to
6e8950b
Compare
invenio_db/shared.py
Outdated
def process_bind_param(self, value, dialect): | ||
"""Process value storing into database.""" | ||
if isinstance(value, datetime): | ||
return value.replace(tzinfo=None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: I think here we should also check that value.tzinfo in (None, timezone.utc)
, and only in that case proceed. I would even go as far as raising an exception if it's not the case, since implicitly dropping the timezone info (or converting from local to UTC) is the behavior we want to avoid.
Needs to be tested in a couple of complex modules first (e.g. invenio-rdm-records
), but I have a feeling that it'll also help us to catch some datetime-related bugs :)
cedbbe0
to
622eae3
Compare
622eae3
to
e1eb285
Compare