Remove reference to pytz library

This commit is contained in:
Lance Edgar 2023-11-11 21:26:11 -06:00
parent fc96fb40fb
commit 853cc871f7

View file

@ -30,7 +30,6 @@ import warnings
import humanize
import markdown
import pytz
from rattail.time import timezone, make_utc
from rattail.files import resource_path
@ -207,10 +206,12 @@ def pretty_datetime(config, value):
if not value:
return ''
app = config.get_app()
# Make sure we're dealing with a tz-aware value. If we're given a naive
# value, we assume it to be local to the UTC timezone.
if not value.tzinfo:
value = pytz.utc.localize(value)
value = app.make_utc(value, tzinfo=True)
# Calculate time diff using UTC.
time_ago = datetime.datetime.utcnow() - make_utc(value)
@ -242,7 +243,7 @@ def raw_datetime(config, value, verbose=False, as_date=False):
# Make sure we're dealing with a tz-aware value. If we're given a naive
# value, we assume it to be local to the UTC timezone.
if not value.tzinfo:
value = pytz.utc.localize(value)
value = app.make_utc(value, tzinfo=True)
# Calculate time diff using UTC.
time_ago = datetime.datetime.utcnow() - make_utc(value)