1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #32735 -- Made DateFormat.Y() return a zero-padded year.

This commit is contained in:
Nick Pope
2021-05-10 15:33:48 +01:00
committed by Mariusz Felisiak
parent b1a4b1f0bd
commit 34363a391b
3 changed files with 8 additions and 4 deletions

View File

@@ -166,7 +166,7 @@ class DateFormatTests(SimpleTestCase):
'Sun, 08 Jul 1979 22:00:00 +0100',
)
def test_year_before_1000(self):
def test_y_format_year_before_1000(self):
tests = [
(476, '76'),
(42, '42'),
@@ -179,6 +179,10 @@ class DateFormatTests(SimpleTestCase):
expected_date,
)
def test_Y_format_year_before_1000(self):
self.assertEqual(dateformat.format(datetime(1, 1, 1), 'Y'), '0001')
self.assertEqual(dateformat.format(datetime(999, 1, 1), 'Y'), '0999')
def test_twelve_hour_format(self):
tests = [
(0, '12'),