Ticket #7443: timesince.diff

File timesince.diff, 1.1 KB (added by Andrew Shearer <andrew@…>, 7 years ago)

Patch

  • django/template/defaultfilters.py

     
    643643    if not value:
    644644        return u''
    645645    if arg:
    646         return timesince(arg, value)
     646        return timesince(value, arg)
    647647    return timesince(value)
    648648timesince.is_safe = False
    649649
  • tests/regressiontests/defaultfilters/tests.py

     
    352352>>> timesince(datetime.datetime.now() - datetime.timedelta(1))
    353353u'1 day'
    354354
     355>>> timesince(datetime.datetime(2005, 12, 29), datetime.datetime(2005, 12, 30))
     356u'1 day'
     357
     358>>> timeuntil(datetime.datetime.now() + datetime.timedelta(1))
     359u'1 day'
     360
     361>>> timeuntil(datetime.datetime(2005, 12, 30), datetime.datetime(2005, 12, 29))
     362u'1 day'
     363
    355364>>> default(u"val", u"default")
    356365u'val'
    357366
Back to Top