diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2006-06-21 06:56:08 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2006-06-21 06:56:08 +0000 |
| commit | 239adf83d33c47ea6dd961904d79962cd7e5a65c (patch) | |
| tree | 8b5e9a87690b05b74dff89d6d8d128eaa398918c /django/utils | |
| parent | c4fa8a158aa3ca0623c867ae67afc47b92277ed6 (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 'django/utils')
| -rw-r--r-- | django/utils/timesince.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/django/utils/timesince.py b/django/utils/timesince.py index bc4f969dc4..0b94d89bc6 100644 --- a/django/utils/timesince.py +++ b/django/utils/timesince.py @@ -47,10 +47,11 @@ def timesince(d, now=None): s += ', %d %s' % (count2, name2(count2)) return s -def timeuntil(d): +def timeuntil(d, now=None): """ Like timesince, but returns a string measuring the time until the given time. """ - now = datetime.datetime.now() + if now == None: + now = datetime.datetime.now() return timesince(now, d) |
