Django

Code

Ticket #2675 (closed: fixed)

Opened 2 years ago

Last modified 1 year ago

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

Reported by: Gary Wilson <gary.wilson@gmail.com> Assigned to: nickefford
Milestone: Component: Template system
Version: SVN Keywords: sprintsept14
Cc: gary.wilson@gmail.com Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

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

Attachments

timesince.diff (2.4 kB) - added by nickefford on 09/14/07 08:46:32.
Patch for django.utils.timesince and template docs
timesince.zip (0.9 kB) - added by nickefford on 09/14/07 08:47:58.
New tests for django.utils.timesince

Change History

01/30/07 23:34:49 changed by Gary Wilson <gary.wilson@gmail.com>

  • stage changed from Unreviewed to Accepted.

09/14/07 04:58:59 changed by nickefford

  • owner changed from nobody to nickefford.
  • status changed from new to assigned.

09/14/07 05:32:53 changed by nickefford

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

09/14/07 08:45:49 changed by nickefford

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

09/14/07 08:46:32 changed by nickefford

  • attachment timesince.diff added.

Patch for django.utils.timesince and template docs

09/14/07 08:47:58 changed by nickefford

  • attachment timesince.zip added.

New tests for django.utils.timesince

09/14/07 08:50:12 changed by nickefford

  • has_patch set to 1.

09/14/07 20:41:32 changed by nickefford

  • keywords set to sprintsept14.

09/16/07 23:50:12 changed by gwilson

  • status changed from assigned to closed.
  • resolution set to fixed.

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


Add/Change #2675 (using timeuntil template filter on a past date results in random number of milliseconds)




Change Properties
Action