Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#12194 closed (invalid)

PROPOSAL: Add a time difference filter to django.contrib.humanize

Reported by: stemmetje Owned by: nobody
Component: Template system Version: dev
Severity: Keywords: filter humanize
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I propose we add a time difference filter to the filters available in django.contrib.humanize. The filter would act on a given time, date or datetime object and compare it another time, date or datetime object or to datetime.datetime.now() if no argument is given. The time difference between the two objects would then be expressed in a human-friendly manner such as 'about 1 minute' or 'about 1 month'.

Attachments (2)

natural_timedelta.diff (8.0 KB ) - added by stemmetje 15 years ago.
Code for the proposed change in DIFF format.
natural_timedelta.2.diff (8.3 KB ) - added by stemmetje 15 years ago.
A slightly better version of the code filter.

Download all attachments as: .zip

Change History (4)

by stemmetje, 15 years ago

Attachment: natural_timedelta.diff added

Code for the proposed change in DIFF format.

by stemmetje, 15 years ago

Attachment: natural_timedelta.2.diff added

A slightly better version of the code filter.

comment:1 by James Bennett, 15 years ago

Resolution: invalid
Status: newclosed

The timesince and timeuntil filters, already built in to Django, provide this functionality.

comment:2 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

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