diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2025-02-18 08:35:36 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-18 08:35:36 +0100 |
| commit | efb7f9ced2dcf71294353596a265e3fd67faffeb (patch) | |
| tree | b24b6127022fbe48c517d1acbe9e3c0c502391d9 /django/contrib/humanize | |
| parent | 0d1dd6bba0c18b7feb6caa5cbd8df80fbac54afd (diff) | |
Refs #36005 -- Used datetime.UTC alias instead of datetime.timezone.utc.
datetime.UTC was added in Python 3.11.
Diffstat (limited to 'django/contrib/humanize')
| -rw-r--r-- | django/contrib/humanize/templatetags/humanize.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/contrib/humanize/templatetags/humanize.py b/django/contrib/humanize/templatetags/humanize.py index 2e3f133033..f471f59389 100644 --- a/django/contrib/humanize/templatetags/humanize.py +++ b/django/contrib/humanize/templatetags/humanize.py @@ -1,5 +1,5 @@ import re -from datetime import date, datetime, timezone +from datetime import UTC, date, datetime from decimal import Decimal from django import template @@ -297,7 +297,7 @@ class NaturalTimeFormatter: if not isinstance(value, date): # datetime is a subclass of date return value - now = datetime.now(timezone.utc if is_aware(value) else None) + now = datetime.now(UTC if is_aware(value) else None) if value < now: delta = now - value if delta.days != 0: |
