#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)
Change History (4)
by , 16 years ago
| Attachment: | natural_timedelta.diff added |
|---|
by , 16 years ago
| Attachment: | natural_timedelta.2.diff added |
|---|
A slightly better version of the code filter.
comment:1 by , 16 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
The timesince and timeuntil filters, already built in to Django, provide this functionality.
Code for the proposed change in DIFF format.