{% for hour in range(calendar_start|timestamp_to_hour, calendar_end|timestamp_to_hour + 1) %}
{% for minute in [0, 30] %}
{{ "%02d:%02d"|format(hour, minute) }}
{% endfor %}
{% endfor %}
{% if events %}
{% for event in events %}
{% if event.end > calendar_start and event.start < calendar_end %}
{% set event_start = event.start|date_fmt(tz_name=tz_name) %}
{% set event_end = event.end|date_fmt(tz_name=tz_name) %}
{% set event_duration = event.start|delta_to_human(event.end) %}
{% set ns = namespace(event_classes = []) %}
{% if event.start < calendar_start %}
{% set ns.event_classes = ns.event_classes + ['already-started'] %}
{% endif %}
{% if event.end > calendar_end %}
{% set ns.event_classes = ns.event_classes + ['not-finished'] %}
{% endif %}
{% for other_event in events %}
{% if event != other_event and event.start < other_event.end and event.end > other_event.start %}
{% set ns.event_classes = ns.event_classes + ['is-conflicting'] %}
{% endif %}
{% endfor %}
{% set event_top = [(((event.start - calendar_start) / 1800 * 30) + 15), 0]|max|int %}
{% set event_height = [((event.end - event.start) / 1800 * 30), ]|min|int %}
{{ event.name[""] }}
{{ event_start }} - {{ event_end }} ({{ event_duration }})
{% endif %}
{% endfor %}
{% endif %}