next_month and previous_month in views.generic.date_based.archive_month return wrong dates
|Reported by:||alasdair||Owned by:||fperetti|
|Severity:||Keywords:||next_month previous_month, pycamp2009|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
next_month and previous_month return different days than the documentation says. This isn't a huge problem, since it is probably the month that is required.
The documentation says that django.views.generic.date_based.archive_month should return:
"next_month: A datetime.date object representing the first day of the next month ..."
However it returns a datetime.date object representing the second day of the next month. This is because on lines 146 and 148, a timedelta is added to last_month, which is already set to the required first date.
Similarly, the documentation says:
"previous_month: A datetime.date object representing the first day of the previous month ..."
when it actually returns the last day of the previous month.
This is my first django bug report, apologies if I've done it in the wrong way.
Change History (12)
comment:1 Changed 8 years ago by
|Patch needs improvement:||unset|
|Triage Stage:||Unreviewed → Accepted|