Opened 16 years ago

Closed 15 years ago

Last modified 12 years ago

#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)

9065-fix.diff (532 bytes ) - added by Tom Mortimer-Jones 16 years ago.
Patch
9065-tests.diff (1.6 KB ) - added by Tom Mortimer-Jones 16 years ago.
9065-combined.diff (2.4 KB ) - added by Matt Boersma 15 years ago.
Combined diff file, updated against trunk [10088]

Download all attachments as: .zip

Change History (12)

comment:1 by Tom Mortimer-Jones, 16 years ago

The timesince function converts instances of Date to DateTime before doing the calculation. The from value is converted, but the to value is not. I am attaching a patch to fix this bug.

by Tom Mortimer-Jones, 16 years ago

Attachment: 9065-fix.diff added

Patch

by Tom Mortimer-Jones, 16 years ago

Attachment: 9065-tests.diff added

comment:2 by Alex Robbins, 15 years ago

Has patch: set

Just noticed there was a patch but "Has patch" wasn't set.

comment:3 by (none), 15 years ago

milestone: post-1.0

Milestone post-1.0 deleted

comment:4 by Jacob, 15 years ago

milestone: 1.1
Triage Stage: UnreviewedAccepted

by Matt Boersma, 15 years ago

Attachment: 9065-combined.diff added

Combined diff file, updated against trunk [10088]

comment:5 by Matt Boersma, 15 years ago

Triage Stage: AcceptedReady for checkin

I applied the patch and re-tested against django-trunk.

comment:6 by Gary Wilson, 15 years ago

Owner: changed from nobody to Gary Wilson
Status: newassigned

comment:7 by Gary Wilson, 15 years ago

Resolution: fixed
Status: assignedclosed

(In [10215]) Fixed #9065 -- Fixed the timesince and timeuntil template tags to work when both values involved are date objects, thanks to morty and mboersma for the patch.

comment:8 by Gary Wilson, 15 years ago

(In [10216]) [1.0.X]: Fixed #9065 -- Fixed the timesince and timeuntil template tags to work when both values involved are date objects, thanks to morty and mboersma for the patch.

Backport of r10215 from trunk.

comment:9 by Jacob, 12 years ago

milestone: 1.1

Milestone 1.1 deleted

Note: See TracTickets for help on using tickets.
Back to Top