Opened 6 years ago

Closed 6 years ago

Last modified 4 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: master
Severity: Keywords: filter humanize
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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 6 years ago.
Code for the proposed change in DIFF format.
natural_timedelta.2.diff (8.3 KB) - added by stemmetje 6 years ago.
A slightly better version of the code filter.

Download all attachments as: .zip

Change History (4)

Changed 6 years ago by stemmetje

Code for the proposed change in DIFF format.

Changed 6 years ago by stemmetje

A slightly better version of the code filter.

comment:1 Changed 6 years ago by ubernostrum

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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

comment:2 Changed 4 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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