diff options
-rw-r--r-- | utils.py | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -34,6 +34,8 @@ def get_current_or_next_week(): def get_week(year, week): start = timezone.make_aware(datetime.datetime.strptime( "{0}-W{1}-1".format(year, week), "%Y-W%W-%w")) + if datetime.datetime(year, 1, 4).isoweekday() > 4: + start -= datetime.timedelta(weeks=1) end = start + datetime.timedelta(weeks=1) return start, end |