Opened 18 years ago

Closed 17 years ago

#2675 closed defect (fixed)

using timeuntil template filter on a past date results in random number of milliseconds

Reported by: Gary Wilson <gary.wilson@…> Owned by: Nick Efford
Component: Template system Version: dev
Severity: normal Keywords: sprintsept14
Cc: gary.wilson@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

It should instead display "0 seconds" or something of the sort.

Attachments (2)

timesince.diff (2.4 KB ) - added by Nick Efford 17 years ago.
Patch for django.utils.timesince and template docs
timesince.zip (943 bytes ) - added by Nick Efford 17 years ago.
New tests for django.utils.timesince

Download all attachments as: .zip

Change History (9)

comment:1 by Gary Wilson <gary.wilson@…>, 17 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Nick Efford, 17 years ago

Owner: changed from nobody to Nick Efford
Status: newassigned

comment:3 by Nick Efford, 17 years ago

Looking at django.utils.timesince, I discover that calling the timesince function on a time in the near future or the timeuntil function on a time in the near past both yield the result '-1 years 12 months'.

comment:4 by Nick Efford, 17 years ago

The attached patch fixes django.utils.timesince.timesince so that negative time intervals are rendered as "0 minutes", and amends the template documentation accordingly. I've added suitable tests, and these are provided as the attached zipfile. (Unzipping this file in the top-level directory should create a timesince directory under regressiontests.)

by Nick Efford, 17 years ago

Attachment: timesince.diff added

Patch for django.utils.timesince and template docs

by Nick Efford, 17 years ago

Attachment: timesince.zip added

New tests for django.utils.timesince

comment:5 by Nick Efford, 17 years ago

Has patch: set

comment:6 by Nick Efford, 17 years ago

Keywords: sprintsept14 added

comment:7 by Gary Wilson, 17 years ago

Resolution: fixed
Status: assignedclosed

(In [6366]) Fixed #2675 -- Changed the timeuntil and timesince template filters to display "0 minutes" when passed a past or future date respectively instead of "-1 years, 12 months". Thanks to nickefford for the patch.

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