summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2023-01-18 12:57:54 +0100
committerGitHub <noreply@github.com>2023-01-18 12:57:54 +0100
commita04565845ae3e766a1a4ec827a6e1f4fac335c3a (patch)
treee5ca83f2e39e5269153013cf47ac26a98f6eb547 /django/utils
parentb209518089131c6b4afd18b1d9c320ba3521c5ab (diff)
downloaddjango-a04565845ae3e766a1a4ec827a6e1f4fac335c3a.tar.gz
Refs #34233 -- Referenced isocalendar() results by names not indexes.
isocalendar() returns a namedtuple() instead of tuple in Python 3.9+
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/dateformat.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/utils/dateformat.py b/django/utils/dateformat.py
index f352c99f1a..a6c315e4cf 100644
--- a/django/utils/dateformat.py
+++ b/django/utils/dateformat.py
@@ -257,7 +257,7 @@ class DateFormat(TimeFormat):
def o(self):
"ISO 8601 year number matching the ISO week number (W)"
- return self.data.isocalendar()[0]
+ return self.data.isocalendar().year
def r(self):
"RFC 5322 formatted date; e.g. 'Thu, 21 Dec 2000 16:01:07 +0200'"
@@ -303,7 +303,7 @@ class DateFormat(TimeFormat):
def W(self):
"ISO-8601 week number of year, weeks starting on Monday"
- return self.data.isocalendar()[1]
+ return self.data.isocalendar().week
def y(self):
"""Year, 2 digits with leading zeros; e.g. '99'."""