diff options
Diffstat (limited to 'utils.py')
-rw-r--r-- | utils.py | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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")) |