mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #32149 -- Added support for years < 1000 to DateFormat.y().
This commit is contained in:
parent
c448e614c6
commit
895f6e4992
3 changed files with 16 additions and 3 deletions
|
@ -165,3 +165,16 @@ class DateFormatTests(SimpleTestCase):
|
|||
dateformat.format(dt, 'r'),
|
||||
'Sun, 08 Jul 1979 22:00:00 +0100',
|
||||
)
|
||||
|
||||
def test_year_before_1000(self):
|
||||
tests = [
|
||||
(476, '76'),
|
||||
(42, '42'),
|
||||
(4, '04'),
|
||||
]
|
||||
for year, expected_date in tests:
|
||||
with self.subTest(year=year):
|
||||
self.assertEqual(
|
||||
dateformat.format(datetime(year, 9, 8, 5, 0), 'y'),
|
||||
expected_date,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue