From 8ebef73249abb64cdbbc3ffb362d6d68533d05b5 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 17 Jan 2023 13:01:53 +0000 Subject: [PATCH] Check that the end time is greater --- webapp_calendar.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/webapp_calendar.py b/webapp_calendar.py index 0174359cd..051111a5c 100644 --- a/webapp_calendar.py +++ b/webapp_calendar.py @@ -274,16 +274,22 @@ def _html_calendar_day(person_cache: {}, translate: {}, event_class = 'calendar__day__event__public__rtl' cal_item_class = 'calItemPublic' if event_time: - if event_end_time and start_time_str != end_time_str: - event_time = \ - ' - ' + \ - '' - else: - event_time = \ - '' + event_time = \ + '' + if event_time and event_end_time and \ + start_time_str != end_time_str: + event_time_int_str = event_time.replace(':', '') + event_end_time_int_str = event_end_time.replace(':', '') + if event_time_int_str.isdigit() and \ + event_end_time_int_str.isdigit(): + if int(event_end_time_int_str) > \ + int(event_time_int_str): + event_time = \ + ' - ' + \ + '' if event_time and event_description and event_place: calendar_str += \ '' + \