mirror of https://github.com/django/django.git
Fixed #2528 -- Fixed 'time' template filter for midnight time value. Thanks, django@dougma.com
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3563 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
6f8e9be24a
commit
74f5d2b9b0
|
@ -339,7 +339,7 @@ def date(value, arg=None):
|
|||
def time(value, arg=None):
|
||||
"Formats a time according to the given format"
|
||||
from django.utils.dateformat import time_format
|
||||
if not value:
|
||||
if value in (None, ''):
|
||||
return ''
|
||||
if arg is None:
|
||||
arg = settings.TIME_FORMAT
|
||||
|
|
|
@ -231,6 +231,9 @@ False
|
|||
>>> time(datetime.time(13), "h")
|
||||
'01'
|
||||
|
||||
>>> time(datetime.time(0), "h")
|
||||
'12'
|
||||
|
||||
# real testing is done in timesince.py, where we can provide our own 'now'
|
||||
>>> timesince(datetime.datetime.now() - datetime.timedelta(1))
|
||||
'1 day'
|
||||
|
|
Loading…
Reference in New Issue