mirror of
https://github.com/django/django.git
synced 2025-11-20 03:30:00 +00:00
Refs #27637 -- Fixed timesince, timeuntil on New Year's Eve in a leap year.
This commit is contained in:
parent
26c9f529c9
commit
6128c1736d
4 changed files with 13 additions and 4 deletions
|
|
@ -110,6 +110,12 @@ class TimesinceTests(unittest.TestCase):
|
|||
self.assertEqual(timeuntil(start_date + self.oneweek, start_date), '1\xa0week')
|
||||
self.assertEqual(timesince(start_date, start_date + self.oneweek), '1\xa0week')
|
||||
|
||||
def test_leap_year_new_years_eve(self):
|
||||
t = datetime.date(2016, 12, 31)
|
||||
now = datetime.datetime(2016, 12, 31, 18, 0, 0)
|
||||
self.assertEqual(timesince(t + self.oneday, now), '0\xa0minutes')
|
||||
self.assertEqual(timeuntil(t - self.oneday, now), '0\xa0minutes')
|
||||
|
||||
def test_naive_datetime_with_tzinfo_attribute(self):
|
||||
class naive(datetime.tzinfo):
|
||||
def utcoffset(self, dt):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue