Calendar stuff is hard

This commit is contained in:
Raphael Michel
2020-10-06 15:00:26 +02:00
parent 5cd6cba0a2
commit 4ed872d4ef
2 changed files with 2 additions and 2 deletions

View File

@@ -467,7 +467,7 @@ class EventIndex(EventViewMixin, EventListMixin, CartMixin, TemplateView):
context['days'] = days_for_template(ebd, week) context['days'] = days_for_template(ebd, week)
context['weeks'] = [ context['weeks'] = [
(date.fromisocalendar(self.year, i + 1, 1), date.fromisocalendar(self.year, i + 1, 7)) (date.fromisocalendar(self.year, i + 1, 1), date.fromisocalendar(self.year, i + 1, 7))
for i in range(53 if date(self.year, 12, 31).isocalendar()[0] == self.year else 52) for i in range(53 if date(self.year, 12, 31).isocalendar()[1] == 53 else 52)
] ]
context['years'] = range(now().year - 2, now().year + 3) context['years'] = range(now().year - 2, now().year + 3)
context['week_format'] = get_format('WEEK_FORMAT') context['week_format'] = get_format('WEEK_FORMAT')

View File

@@ -524,7 +524,7 @@ class WeekCalendarView(OrganizerViewMixin, EventListMixin, TemplateView):
ctx['days'] = days_for_template(ebd, week) ctx['days'] = days_for_template(ebd, week)
ctx['weeks'] = [ ctx['weeks'] = [
(date.fromisocalendar(self.year, i + 1, 1), date.fromisocalendar(self.year, i + 1, 7)) (date.fromisocalendar(self.year, i + 1, 1), date.fromisocalendar(self.year, i + 1, 7))
for i in range(53 if date(self.year, 12, 31).isocalendar()[0] == self.year else 52) for i in range(53 if date(self.year, 12, 31).isocalendar()[1] == 53 else 52)
] ]
ctx['years'] = range(now().year - 2, now().year + 3) ctx['years'] = range(now().year - 2, now().year + 3)
ctx['week_format'] = get_format('WEEK_FORMAT') ctx['week_format'] = get_format('WEEK_FORMAT')