Ticket #2053: timeslice.diff

File timeslice.diff, 939 bytes (added by john@…, 9 years ago)

[patch] for this ticket.

  • django/template/defaultfilters.py

     
    341341        arg = settings.TIME_FORMAT
    342342    return time_format(value, arg)
    343343
    344 def timesince(value):
     344def timesince(value, arg=None):
    345345    'Formats a date as the time since that date (i.e. "4 days, 6 hours")'
    346346    from django.utils.timesince import timesince
    347     return timesince(value)
     347    if arg:
     348        return timesince(arg, value)
     349    else:
     350        return timesince(value)
    348351
     352def timeuntil(value, arg=None):
     353    'Formats a date as the time until that date (i.e. "4 days, 6 hours")'
     354    from django.utils.timesince import timeuntil
     355    if arg:
     356        return timeuntil(arg, value)
     357    else:
     358        return timeuntil(value)
     359
     360
    349361###################
    350362# LOGIC           #
    351363###################
Back to Top