From 3111d7f60b67d5aefa4d891d1d9a86ba56d7607c Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Tue, 26 Aug 2008 08:08:55 +0000 Subject: 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 --- docs/ref/templates/builtins.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'docs/ref') diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt index 20c5ee513e..6fc0d5cf1e 100644 --- a/docs/ref/templates/builtins.txt +++ b/docs/ref/templates/builtins.txt @@ -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. -- cgit v1.3