Opened 10 years ago

Closed 9 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: master
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: UI/UX:

Description

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

Attachments (2)

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

Download all attachments as: .zip

Change History (9)

comment:1 Changed 10 years ago by Gary Wilson <gary.wilson@…>

Triage Stage: UnreviewedAccepted

comment:2 Changed 9 years ago by Nick Efford

Owner: changed from nobody to Nick Efford
Status: newassigned

comment:3 Changed 9 years ago by Nick Efford

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 Changed 9 years ago by Nick Efford

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.)

Changed 9 years ago by Nick Efford

Attachment: timesince.diff added

Patch for django.utils.timesince and template docs

Changed 9 years ago by Nick Efford

Attachment: timesince.zip added

New tests for django.utils.timesince

comment:5 Changed 9 years ago by Nick Efford

Has patch: set

comment:6 Changed 9 years ago by Nick Efford

Keywords: sprintsept14 added

comment:7 Changed 9 years ago by Gary Wilson

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