From 853cc871f7f1c8e6e484cf7c3fea286d310b3fa8 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 11 Nov 2023 21:26:11 -0600 Subject: [PATCH] Remove reference to `pytz` library --- tailbone/util.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tailbone/util.py b/tailbone/util.py index fdd36572..db6ce4a3 100644 --- a/tailbone/util.py +++ b/tailbone/util.py @@ -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)