aboutsummaryrefslogtreecommitdiff
path: root/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/utils.py b/utils.py
index 3479b47..1a177b4 100644
--- a/utils.py
+++ b/utils.py
@@ -2,6 +2,13 @@ from django.utils import timezone
import datetime
+def get_current_or_next_week():
+ year, week, day = timezone.now().isocalendar()
+ if day >= 6:
+ year, week, _ = (timezone.now() + datetime.timedelta(weeks=1)).isocalendar()
+
+ return year, week
+
def get_week(year, week):
start = timezone.make_aware(datetime.datetime.strptime(
"{0}-W{1:02d}-1".format(year, week), "%Y-W%W-%w"))