timesince template filter reverses its parameters when given a base date
|Reported by:||Owned by:||nobody|
|Severity:||Keywords:||timesince timeuntil date handling filter|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The timesince template filter appears to swap its parameters when given a base date argument, leading to a typical result of "0 minutes" instead of the expected time difference. This makes it a synonym of the timeuntil filter. Omitting the optional argument makes both filters work as expected.
The django.utils.timesince function itself works correctly. The timesince and timeuntil template filters both call it with an identical line of code, explaining their matching results.
A patch is attached that un-flips the parameters and adds test coverage of the base date argument to the filters.
Change History (12)
comment:1 follow-up: 4 Changed 8 years ago by
|Patch needs improvement:||unset|