Skip to content
Snippets Groups Projects
Commit 8a10622e authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Merge branch...

Merge branch '9-weeks_within-start-end-misses-last-week-if-the-start-weekday-is-bigger-then-the-end-weekday' into 'master'

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

Closes #9

See merge request !10
parents 6e5d016b 322595d8
No related branches found
No related tags found
1 merge request!10Resolve "weeks_within(start, end) misses last week if the start weekday is bigger then the end weekday"
......@@ -7,6 +7,14 @@ The format is based on `Keep a Changelog <http://keepachangelog.com/>`__
and this project adheres to `Semantic
Versioning <http://semver.org/>`__.
0.5.3
-----
Fixed
~~~~~
* CalendarWeek.weeks_within missed last week if the start weekday was bigger then the end weekday
0.5.2
-----
......
......@@ -86,11 +86,14 @@ class CalendarWeek:
if start > end:
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 = []
while current < end:
weeks.append(cls.from_date(current))
current += timedelta(days=7)
while current <= end_week:
weeks.append(current)
current += 1
return weeks
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment