Opened 10 years ago

Closed 10 years ago

Last modified 10 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: master
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: UI/UX:

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@… 10 years ago.
[patch] for this ticket.
timesince.diff (4.0 KB) - added by john@… 10 years ago.
[patch] for this ticket.

Download all attachments as: .zip

Change History (6)

Changed 10 years ago by john@…

Attachment: timeslice.diff added

[patch] for this ticket.

comment:1 Changed 10 years ago by john@…

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 Changed 10 years ago by Adrian Holovaty

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

Changed 10 years ago by john@…

Attachment: timesince.diff added

[patch] for this ticket.

comment:3 Changed 10 years ago by john@…

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

comment:4 Changed 10 years ago by Malcolm Tredinnick

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