#9065 closed (fixed)
timesince filter not calculating difference between two dates
Reported by: | rcornish | Owned by: | Gary Wilson |
---|---|---|---|
Component: | Template system | Version: | 1.0 |
Severity: | Keywords: | template, filter, timesince | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
My template code is:
{% with publication.list|last as oldest %}
{% with publication.list|first as newest %}
{{ newest.date|timesince:oldest.date }}
{% endwith %}{% endwith %}
It calculated the dates between the newest and oldest entries. It worked before 1.0, and now it doesn't. {{ newest.date}} and {{ oldest.date }} by themselves both return dates. Help. :(
Attachments (3)
Change History (12)
comment:1 by , 16 years ago
by , 16 years ago
Attachment: | 9065-tests.diff added |
---|
comment:2 by , 16 years ago
Has patch: | set |
---|
Just noticed there was a patch but "Has patch" wasn't set.
comment:4 by , 16 years ago
milestone: | → 1.1 |
---|---|
Triage Stage: | Unreviewed → Accepted |
by , 16 years ago
Attachment: | 9065-combined.diff added |
---|
Combined diff file, updated against trunk [10088]
comment:5 by , 16 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
I applied the patch and re-tested against django-trunk.
comment:6 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:7 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
The timesince function converts instances of
Date
toDateTime
before doing the calculation. The from value is converted, but the to value is not. I am attaching a patch to fix this bug.