0.91-bugfixes: Backport silent failure of date-related template filters

git-svn-id: http://code.djangoproject.com/svn/django/branches/0.91-bugfixes@6468 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
James Bennett 2007-10-08 20:53:23 +00:00
parent d797b34bf8
commit 56c074f565
1 changed files with 6 additions and 0 deletions

View File

@ -329,16 +329,22 @@ def get_digit(value, arg):
def date(value, arg=DATE_FORMAT):
"Formats a date according to the given format"
if not value:
return ''
from django.utils.dateformat import format
return format(value, arg)
def time(value, arg=TIME_FORMAT):
"Formats a time according to the given format"
if not value:
return ''
from django.utils.dateformat import time_format
return time_format(value, arg)
def timesince(value):
'Formats a date as the time since that date (i.e. "4 days, 6 hours")'
if not value:
return ''
from django.utils.timesince import timesince
return timesince(value)