Skip to content

WIP: Replace datetime.utcnow() with datetime.now(timezone.utc)

Richard Kennedy requested to merge richken/use_timezone_aware_datetime into master

Description

Currently, it is not recommended to use datetime.utcnow() since it is not timezone aware: https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow. The timestamps are stored as timezone unaware objects in postgres, and consequently can be treated as local time in our operations. This mr replaces usage of utcnow, with datetime.now(timezone.utc), which is timezone aware.

Edited by Richard Kennedy

Merge request reports