Merge pull request #285 from fndax/patch-2

[Tweets] Fix tweet age calc for TZ!=UTC
This commit is contained in:
jess 2020-11-05 15:19:13 +00:00 committed by GitHub
commit 74da824e53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,7 +2,7 @@ import datetime, html, time
from src import utils from src import utils
def _timestamp(dt): def _timestamp(dt):
seconds_since = time.time()-dt.timestamp() seconds_since = time.time()-dt.replace(tzinfo=datetime.timezone.utc).timestamp()
timestamp = utils.datetime.format.to_pretty_since( timestamp = utils.datetime.format.to_pretty_since(
seconds_since, max_units=2) seconds_since, max_units=2)
return "%s ago" % timestamp return "%s ago" % timestamp