{% load event_tags pages_tags mezzanine_tags organization_tags i18n %}
+{% with event.periods.all as periods %}
<!-- Start date only -->
{% if event.start and not event.end %}
{{ event.start|date:"DATE_EVENT_FORMAT" }},<br>
{% else %}
<!-- Start and end date is the same day -->
{% if event.start|date:"d.m.y" == event.end|date:"d.m.y" %}
- {% if not event.periods.all %}
+ {% if not periods %}
{{ event.start|date:"DATE_EVENT_FORMAT" }},<br>
<!-- Start date with hour -->
{% if event.end and event.end|date:"H:i" != "23:59" %}
{% endif %}
{% else %}
{{ event.start|date:"DATE_EVENT_FORMAT" }},<br>
- {% for period in event.periods.all %}
+ {% for period in periods %}
{% if period.date_to and period.date_to|date:"H:i" != "23:59" %}
{{ period.date_from|time:"TIME_FORMAT" }} - {{ period.date_to|time:"TIME_FORMAT" }}
{% else %}
- {% if forloop.last or event.periods.all|length == 2 %} {% trans "and"%} {% elif not forloop.first %}, {% endif %}
+ {% if forloop.last or periods|length == 2 %} {% trans "and"%} {% elif not forloop.first %}, {% endif %}
{{ period.date_from|time:"TIME_FORMAT" }}
{% endif %}
{% endfor %}
<!-- Start and end date are the same month -->
{% elif event.start|date:"m.y" == event.end|date:"m.y" %}
- {% if event.periods.all %}
- {% with event.periods.all|same_time_in_periods as same_time_in_periods %}
- {% for period in event.periods.all %}
+ {% if periods %}
+ {% with periods|same_time_in_periods as same_time_in_periods %}
+ {% for period in periods %}
{% if period.date_to and period.date_to|date:"H:i" != "23:59" %}
- {{ period.date_from|date:"DATE_EVENT_FORMAT" }},<br>
+ {{ period.date_from|date:"WEEK_DAY_FORMAT" }},<br>
{% if period|period_is_more_than_hours:4 %}
{{ period.date_from|time:"DATE_EVENT_FORMAT" }} {% trans "through" %} {{ period.date_to|time:"TIME_FORMAT" }}
{% else %}
{{ period.date_from|time:"TIME_FORMAT" }}
{% endif %}
{% else %}
- {% if event.periods.all|length > 1 and not forloop.last %}
- {{ period.date_from|date:"DATE_EVENT_FORMAT" }}{% if event.periods.all|length == 2 %} {% trans "and" %} {% else %},{% endif %}
+ {% if periods|length > 1 and not forloop.last %}
+ {{ period.date_from|date:"WEEK_DAY_FORMAT" }}{% if periods|length == 2 %} {% trans "and" %} {% else %},{% endif %}
{% else %}
- {{ period.date_from|date:"DATE_EVENT_FORMAT" }},
- {% if event.periods.all|length > 1 and forloop.first %}{% trans "and" %}{% endif %}
+ {{ period.date_from|date:"WEEK_DAY_FORMAT" }},
+ {% if periods|length > 1 and forloop.first %}{% trans "and" %}{% endif %}
{% endif %}
{% if same_time_in_periods and forloop.last %}
{{ period.date_from|time:"TIME_FORMAT" }}
{% endfor %}
{% endwith %}
{% else %}
- {{ event.start|date:"DATE_EVENT_FORMAT" }}
+ {{ event.start|date:"WEEK_DAY_FORMAT" }}
{% if event.end|subtract:event.start|get_attr:"days" > 1 %}
{% trans "through" %}
{% else %}
{% endif %}
{% endif %}
+{% endwith %}
--- /dev/null
+{% load event_tags pages_tags mezzanine_tags organization_tags i18n %}
+{% with event.periods.all as periods %}
+ <!-- Start date only -->
+ {% if event.start and not event.end %}
+ {{ event.start|date:"DATE_EVENT_FORMAT" }},<br>
+ <!-- Start date with hour -->
+ {% if event.start and event.start|date:"H:i" != "23:59" %}
+ {{ event.start|time:"TIME_FORMAT" }}
+ {% endif %}
+ <!-- Start and end date -->
+ {% else %}
+ <!-- Start and end date is the same day -->
+ {% if event.start|date:"d.m.y" == event.end|date:"d.m.y" %}
+ {% if not periods %}
+ {{ event.start|date:"DATE_EVENT_FORMAT" }},<br>
+ <!-- Start date with hour -->
+ {% if event.end and event.end|date:"H:i" != "23:59" %}
+ {{ event.start|time:"TIME_FORMAT" }} - {{ event.end|time:"TIME_FORMAT" }}
+ {% else %}
+ {{ event.start|time:"TIME_FORMAT" }}
+ {% endif %}
+ {% else %}
+ {{ event.start|date:"DATE_EVENT_FORMAT" }},<br>
+ {% for period in periods %}
+ {% if period.date_to and period.date_to|date:"H:i" != "23:59" %}
+ {{ period.date_from|time:"TIME_FORMAT" }} - {{ period.date_to|time:"TIME_FORMAT" }}
+ {% else %}
+ {% if forloop.last or periods|length == 2 %} {% trans "and"%} {% elif not forloop.first %}, {% endif %}
+ {{ period.date_from|time:"TIME_FORMAT" }}
+ {% endif %}
+ {% endfor %}
+ {% endif %}
+ <!-- Start and end date are the same month -->
+ {% elif event.start|date:"m.y" == event.end|date:"m.y" %}
+ {{ event.start|date:"WEEK_DAY_FORMAT" }}
+ {% if event.end|subtract:event.start|get_attr:"days" > 1 %}
+ {% trans "through" %}
+ {% else %}
+ {% trans "and" %}
+ {% endif %}
+ {{ event.end|date:"DATE_EVENT_FORMAT" }}
+ <!-- Start and end date are completely different -->
+ {% else %}
+ {{ event.start|date:"DATE_EVENT_FORMAT" }} {% trans "through" %} {{ event.end|date:"DATE_EVENT_FORMAT" }},<br>
+ <!-- Start date with hour -->
+ {% if event.end and event.end|date:"H:i" != "23:59" %}
+ {{ event.start|time:"TIME_FORMAT" }} - {{ event.end|time:"TIME_FORMAT" }}
+ {% else %}
+ {{ event.start|time:"TIME_FORMAT" }}
+ {% endif %}
+ {% endif %}
+
+ {% endif %}
+{% endwith %}