Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#2053 closed enhancement (fixed)

[patch] Changed timesince filter to take an optional datetime object & added timeuntil filter

Reported by: john@… Owned by: Adrian Holovaty
Component: Template system Version: dev
Severity: minor Keywords: timeslice timeuntil filter
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Useful if we have a blog and want to display comments as "commented 2 hours after the post".

Also added the timeuntil filter for completeness.

Attachments (2)

timeslice.diff (939 bytes ) - added by john@… 18 years ago.
[patch] for this ticket.
timesince.diff (4.0 KB ) - added by john@… 18 years ago.
[patch] for this ticket.

Download all attachments as: .zip

Change History (6)

by john@…, 18 years ago

Attachment: timeslice.diff added

[patch] for this ticket.

comment:1 by john@…, 18 years ago

Summary: [patch] Changed timeslice filter to take an optional datetime object & added timeuntil filter[patch] Changed timesince filter to take an optional datetime object & added timeuntil filter

timeslice should be timesince, in every instance - sorry.

comment:2 by Adrian Holovaty, 18 years ago

Can you add some unit tests for these two filters, please? They should go in tests/othertests/templates.py.

by john@…, 18 years ago

Attachment: timesince.diff added

[patch] for this ticket.

comment:3 by john@…, 18 years ago

The correctly named patch, with Unit Tests and some slight tweaks to the code.

comment:4 by Malcolm Tredinnick, 18 years ago

Resolution: fixed
Status: newclosed

(In [3185]) Fixed #2053 -- added an optional comparison argument to the "timesince" filter.
Added a "timeuntil" filter that works analogously. Thanks, john@….

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