Skip to content
Snippets Groups Projects

Resolve "weeks_within(start, end) misses last week if the start weekday is bigger then the end weekday"

2 files
+ 15
4
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -86,11 +86,14 @@ class CalendarWeek:
@@ -86,11 +86,14 @@ class CalendarWeek:
if start > end:
if start > end:
raise ValueError("End date must be after start date.")
raise ValueError("End date must be after start date.")
current = start
start_week = cls.from_date(start)
 
end_week = cls.from_date(end)
 
 
current = start_week
weeks = []
weeks = []
while current < end:
while current <= end_week:
weeks.append(cls.from_date(current))
weeks.append(current)
current += timedelta(days=7)
current += 1
return weeks
return weeks
Loading