-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add ability to submit time deltas to database query utility #5524
Conversation
Codecov Report
|
# Prevent naive datetime objects | ||
if dt.tzinfo is None: | ||
# The stdlib datetime.timezone.utc doesn't work properly on Windows | ||
dt = dt.replace(tzinfo=pytz.utc) |
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.
We are assuming that since this is coming from a database, its most likely UTC which makes sense.
There are occasions if we have a naive timestamp that we should normalize to local timezone instead, maybe an opportunity for a future PR timeutils module.
An implementation I have used in the past which has been quite handy: https://github.com/riverbed/steelscript/blob/af4405c63f378db5466397fd566beb8226edf647/steelscript/common/timeutils.py#L52
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.
LGTM!
Strange CI errors though .. 🤔
* Add ability to submit time deltas to database query utility * address
Motivation
Many integrations do that