summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorSam <sam@basx.dev>2020-10-27 11:12:14 +0700
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-11-12 12:43:06 +0100
commit895f6e49925ed0ae4bb96dc4d3af17fdc9c4846e (patch)
treed8d0facf3bd5698ae8b2fdb46953d90853b76e8b /django/utils
parentc448e614c60cc97c6194c62052363f4f501e0953 (diff)
Fixed #32149 -- Added support for years < 1000 to DateFormat.y().
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 afd36d79e0..c4d9d035e4 100644
--- a/django/utils/dateformat.py
+++ b/django/utils/dateformat.py
@@ -325,8 +325,8 @@ class DateFormat(TimeFormat):
return self.data.isocalendar()[1]
def y(self):
- "Year, 2 digits; e.g. '99'"
- return str(self.data.year)[2:]
+ """Year, 2 digits with leading zeros; e.g. '99'."""
+ return '%02d' % (self.data.year % 100)
def Y(self):
"Year, 4 digits; e.g. '1999'"