diff options
| author | 2021-04-13 19:05:45 +0200 | |
|---|---|---|
| committer | 2021-04-13 22:28:21 +0200 | |
| commit | 9ab05cbe3f23d442b5bc73311e0c3e8b075e396e (patch) | |
| tree | df685646963ed329af23c56f477c332cf2df8a7e /tests | |
| parent | Merge pull request #1521 from ToxicKidz/dont-use-startswith (diff) | |
Branding: use tz-aware datetime representation
Using `datetime.utcnow` produces a tz-naive object. When converting
the object into a POSIX timestamp (L212), the library then converts
the naive object into UTC, which will offset it unless the local
timezone is UTC. We prevent this behaviour by using an Arrow repr
instead, which is by default tz-aware. Since the object already
knows it is in UTC, it does not shift when converting to a timestamp.
Because L233 used `fromtimestamp` rather than `utcfromtimestamp`,
the timestamp then got converted back into local time, canceling
the previous error. Therefore, the bug wasn't observable from logs,
as the times looked correct, but were being stored incorrectly.
By using `Arrow.utcfromtimestamp`, the created object will be aware
of being UTC again, which is more safe.
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions