mirror of
https://github.com/django/django.git
synced 2025-08-02 18:13:02 +00:00
Fixed #7201 -- Fixed the timeuntil filter to work correctly with timezone-aware
times. Patch from Jeremy Carbaugh. This is backwards incompatible in the sense that previously, if you tried to compare timezone-aware and timezone-naive values, you got an incorrect result. Now you get an empty string. So your previously incorrect code returns a different incorrect result. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8579 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
61957df17f
commit
3111d7f60b
6 changed files with 53 additions and 20 deletions
|
@ -1332,6 +1332,8 @@ For example, if ``blog_date`` is a date instance representing midnight on 1
|
|||
June 2006, and ``comment_date`` is a date instance for 08:00 on 1 June 2006,
|
||||
then ``{{ blog_date|timesince:comment_date }}`` would return "8 hours".
|
||||
|
||||
Comparing offset-naive and offset-aware datetimes will return an empty string.
|
||||
|
||||
Minutes is the smallest unit used, and "0 minutes" will be returned for any
|
||||
date that is in the future relative to the comparison point.
|
||||
|
||||
|
@ -1349,6 +1351,8 @@ Takes an optional argument that is a variable containing the date to use as
|
|||
the comparison point (instead of *now*). If ``from_date`` contains 22 June
|
||||
2006, then ``{{ conference_date|timeuntil:from_date }}`` will return "1 week".
|
||||
|
||||
Comparing offset-naive and offset-aware datetimes will return an empty string.
|
||||
|
||||
Minutes is the smallest unit used, and "0 minutes" will be returned for any
|
||||
date that is in the past relative to the comparison point.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue