Skip to content
This repository was archived by the owner on Apr 5, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions stashboard/handlers/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,17 +302,26 @@ def get(self, service_slug, year=None, month=None, day=None):
return

try:

if year:
year = int(year)
if month:
month = int(month)
if day:
day = int(day)

if day:
start_date = date(int(year), int(month), int(day))
end_date = start_date + timedelta(days=1)
start_date = datetime.date(year, month, day)
end_date = start_date + datetime.timedelta(days=1)
elif month:
start_date = date(int(year), int(month), 1)
start_date = datetime.date(year, month, 1)
days = calendar.monthrange(start_date.year,
start_date.month)[1]
end_date = start_date + timedelta(days=days)
end_date = start_date + datetime.timedelta(days=days)
elif year:
start_date = date(int(year), 1, 1)
end_date = start_date + timedelta(days=365)
leap = 366 if calendar.isleap(year) else 365
start_date = datetime.date(year, 1, 1)
end_date = start_date + datetime.timedelta(days=leap)
else:
start_date = None
end_date = None
Expand Down