Ticket #1385: timesince.patch
File timesince.patch, 1.0 KB (added by , 19 years ago) |
---|
-
django/utils/timesince.py
15 15 (60 * 60, lambda n: ngettext('hour', 'hours', n)), 16 16 (60, lambda n: ngettext('minute', 'minutes', n)) 17 17 ) 18 # Convert datetime.date to datetime.datetime for comparison 19 if d.__class__ is not datetime.datetime: 20 d = datetime.datetime(d.year, d.month, d.day) 18 21 if now: 19 22 t = now.timetuple() 20 23 else: -
tests/othertests/defaultfilters.py
237 237 >>> timesince(datetime.datetime.now() - datetime.timedelta(1)) 238 238 '1 day' 239 239 240 # datetime.date compataibility with timesince 241 >>> timesince(datetime.date.today() - datetime.timedelta(1)) 242 '1 day, 23 hours' 243 240 244 >>> default("val", "default") 241 245 'val' 242 246