diff --git a/webapp_calendar.py b/webapp_calendar.py
index 3d209a738..71325a931 100644
--- a/webapp_calendar.py
+++ b/webapp_calendar.py
@@ -563,56 +563,57 @@ def html_calendar(person_cache: {}, translate: {},
continue
calendar_str += '
\n'
for day_number in range(1, 8):
- if (week_of_month > 1 and day_of_month < days_in_month) or \
- (week_of_month == 1 and day_number >= dow):
- day_of_month += 1
-
- is_today = False
- if year == curr_date.year:
- if curr_date.month == month_number:
- if day_of_month == curr_date.day:
- is_today = True
- if events.get(str(day_of_month)):
- url = cal_actor + '/calendar?year=' + \
- str(year) + '?month=' + \
- str(month_number) + '?day=' + str(day_of_month)
- day_description = month_name + ' ' + str(day_of_month)
- datetime_str = \
- str(year) + '-' + str(month_number) + '-' + \
- str(day_of_month)
- day_link = '' + \
- ''
- # accessibility menu links
- menu_option_str = \
- html_hide_from_screen_reader('📅') + ' ' + \
- ''
- nav_links[menu_option_str] = url
- # there are events for this day
- if not is_today:
- calendar_str += \
- ' ' + \
- day_link + ' | \n'
- else:
- calendar_str += \
- ' ' + \
- day_link + ' | \n'
- else:
- # No events today
- if not is_today:
- calendar_str += \
- ' ' + \
- str(day_of_month) + ' | \n'
- else:
- calendar_str += \
- ' ' + str(day_of_month) + ' | \n'
- else:
+ if not ((week_of_month > 1 and day_of_month < days_in_month) or
+ (week_of_month == 1 and day_number >= dow)):
calendar_str += ' | \n'
+ continue
+
+ day_of_month += 1
+
+ is_today = False
+ if year == curr_date.year:
+ if curr_date.month == month_number:
+ if day_of_month == curr_date.day:
+ is_today = True
+ if events.get(str(day_of_month)):
+ url = cal_actor + '/calendar?year=' + \
+ str(year) + '?month=' + \
+ str(month_number) + '?day=' + str(day_of_month)
+ day_description = month_name + ' ' + str(day_of_month)
+ datetime_str = \
+ str(year) + '-' + str(month_number) + '-' + \
+ str(day_of_month)
+ day_link = '' + \
+ ''
+ # accessibility menu links
+ menu_option_str = \
+ html_hide_from_screen_reader('📅') + ' ' + \
+ ''
+ nav_links[menu_option_str] = url
+ # there are events for this day
+ if not is_today:
+ calendar_str += \
+ ' ' + \
+ day_link + ' | \n'
+ else:
+ calendar_str += \
+ ' ' + \
+ day_link + ' | \n'
+ else:
+ # No events today
+ if not is_today:
+ calendar_str += \
+ ' ' + \
+ str(day_of_month) + ' | \n'
+ else:
+ calendar_str += \
+ ' ' + str(day_of_month) + ' | \n'
calendar_str += '
\n'
calendar_str += '\n'