#886 closed defect (fixed)
timesince breaks on the current time
| Reported by: | aaronsw | Owned by: | Adrian Holovaty |
|---|---|---|---|
| Component: | Tools | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
from datetime import datetime
from django.utils.timesince import timesince
x = timesince(datetime.now())
assert x == "-1 years, 12 months"
I think it should return "12 miliseconds", or at least "0 seconds". (The former would be much more entertaining, though.)
Change History (3)
comment:1 by , 20 years ago
comment:3 by , 20 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
The fix is to add these lines before
if count == 1:if count < 0: return '%d milliseconds' % math.floor(delta.microseconds / 100)