diff --git a/django/utils/timesince.py b/django/utils/timesince.py
index 511acb5..3eb3405 100644
a
|
b
|
def timeuntil(d, now=None):
|
57 | 57 | Like timesince, but returns a string measuring the time until |
58 | 58 | the given time. |
59 | 59 | """ |
| 60 | # Convert datetime.date to datetime.datetime for comparison. |
| 61 | if not isinstance(d, datetime.datetime): |
| 62 | d = datetime.datetime(d.year, d.month, d.day) |
| 63 | |
60 | 64 | if not now: |
61 | 65 | now = datetime.datetime.now(utc if is_aware(d) else None) |
62 | 66 | return timesince(now, d) |
diff --git a/tests/regressiontests/utils/timesince.py b/tests/regressiontests/utils/timesince.py
index b0f94d1..eb44d8b 100644
a
|
b
|
class TimesinceTests(unittest.TestCase):
|
99 | 99 | self.assertEqual(timesince(now_tz), u'0 minutes') |
100 | 100 | self.assertEqual(timeuntil(now_tz, now_tz_i), u'0 minutes') |
101 | 101 | |
| 102 | def test_date_object(self): |
| 103 | """ Timesince and timeuntil should work with date objects (#17937 ) """ |
| 104 | today = datetime.date.today() |
| 105 | self.assertEqual(timeuntil(today-self.oneday), u'0 minutes') |
| 106 | self.assertEqual(timesince(today+self.oneday), u'0 minutes') |
| 107 | |
102 | 108 | def test_both_date_objects(self): |
103 | 109 | """ Timesince should work with both date objects (#9672) """ |
104 | 110 | today = datetime.date.today() |