﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
6749	Generic week view displays Sunday objects in both the current and next week	Jim Garrison	nobody	"Objects on a Sunday are mistakenly displayed in both the correct week and the previous week.

The relevant code from django/views/generic/date_based.py (function archive_week):

{{{
    # Calculate first and last day of week, for use in a date-range lookup.
    first_day = date
    last_day = date + datetime.timedelta(days=7)
    lookup_kwargs = {'%s__range' % date_field: (first_day, last_day)}
}}}

{{{first_day}}} is set from {{{date}}}, which is the Sunday that begins the week.  However, {{{last_day}}} is then set to be the day 7 days after that day, which is the next Sunday.  The final line above sets the range to be from one Sunday to the next Sunday, but the {{{range}}} test is inclusive so both Sundays are included by mistake.

This bug can be fixed by changing the {{{7}}} to a {{{6}}}.  Trivial patch is attached."	Bug	closed	Generic views	dev	Normal	duplicate	archive_week		Accepted	1	0	1	1	0	0
