summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2006-06-21 06:56:08 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2006-06-21 06:56:08 +0000
commit239adf83d33c47ea6dd961904d79962cd7e5a65c (patch)
tree8b5e9a87690b05b74dff89d6d8d128eaa398918c /docs
parentc4fa8a158aa3ca0623c867ae67afc47b92277ed6 (diff)
Fixed #2053 -- added an optional comparison argument to the "timesince" filter.
Added a "timeuntil" filter that works analogously. Thanks, john@sneeu.com. git-svn-id: http://code.djangoproject.com/svn/django/trunk@3185 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/templates.txt18
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/templates.txt b/docs/templates.txt
index 5f397c5a60..42947510d1 100644
--- a/docs/templates.txt
+++ b/docs/templates.txt
@@ -1022,6 +1022,24 @@ timesince
Formats a date as the time since that date (i.e. "4 days, 6 hours").
+Takes an optional argument that is a variable containing the date to use as
+the comparison point (without the argument, the comparison point is *now*).
+For example, if ``blog_date`` is a date instance representing midnight on 1
+June 2006, and ``comment_date`` is a date instanace for 08:00 on 1 June 2006,
+then ``{{ comment_date|timesince:blog_date }}`` would return "8 hours".
+
+timeuntil
+~~~~~~~~~
+
+Similar to ``timesince``, except that it measures the time from now until the
+given date or datetime. For example, if today is 1 June 2006 and
+``conference_date`` is a date instance holding 29 June 2006, then
+``{{ conference_date|timeuntil }}`` will return "28 days".
+
+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 "7 days".
+
title
~~~~~