I’m experiencing an issue with my Grav CMS site where future events beyond a certain date are not displaying. Here are the details:
Events with future dates beyond a certain point (e.g., beyond for from 15.08.2024 ( Today is 18.07.2024) are not showing up on the site. This issue persists despite setting showFutureEvents: true
in the configuration.
In my flex-catalog.en.md
file, I have the following settings:,
options:
showFutureEvents: true
showCurrentEvents: true
showPastEvents: true
sortBy: date
sortDirection: desc
cards_per_row: 3
show_post_titles: true
show_post_date: true
show_post_category: true
group_by_category: true
I’m looking for guidance on resolving this issue so that all future events display correctly, regardless of their date. Any insights or suggestions on what might be causing this limitation and how to fix it would be greatly appreciated.
I debug the Data, it doesn’t fetch any Data for that Time to filter out
and This is the related twig file:
{% import “_macros/typography.twig” as typoMacros %}
{% if not theme_config[‘production-mode’] %}
{% do block.disableCache() %}
{% endif %}
{% set contentParts = object.content|split(‘===’) %}
{% set content = {
summary: contentParts[0],
readmore: contentParts[1] ?? null,
all: contentParts|join
} %}
{% set imageMode = ‘resize’ %}
{% set date_format = ‘d.m.Y’ %}
{% set startdate_format = object.end_date ? 'd.m. ’ : date_format %}
{% set time_format = ‘H:i’ %}
{% set startdate = object.start_date %}
{% set enddate = object.end_date ?: null %}
{% set currentdate = ‘now’|date(‘Y-m-d’) %}
{% set referencedate = enddate ?: startdate %}
{% set pastEvent = referencedate ? referencedate < currentdate %}
{% set options = {
pageContent: (content is not empty),
pageContentClasses: 'event-info',
moduleContent: (image),
moduleClasses: 'article-image',
modulePosition: header.options.image_align ?? 'right',
moduleWidth: header.options.image_width|default('6'),
moduleTitleTag: 'h3',
moduleTitleClass: 'article-heading',
hideModuleTitle: true,
gridStyle: header.options.image_align in ['top', 'bottom'] ? 'vertical' : 'horizontal',
debug: false
} %}
{{ options.debug ? dump(options) }}
{# Prepare content #}
{% set showTitle = true and header.options.showEventTitles|default(true) %}
{% set showDate = true %}
{% set showCategory = true and object.category and object.category != 'Keine' %}
{% set pageContent %}
{% if showCategories %}
<h5 class="category">{{ object.category }}</h5>
{% endif %}
{% if showDate %}
<div class="date fw-bold" data-timestamp="{{ startdate|date('U') }}">
<span class="start-date">{{ startdate|date(startdate_format) }}</span>
{% if enddate %} - <span class="end-date">{{ enddate|date(date_format) }}</span>{% endif %}
</div>
{% endif %}
{% if showDate %}
<div class="date fw-bold" data-timestamp="{{ startdate|date('U') }}">
<span class="start-date">{{ startdate|date(startdate_format) }}</span>
{% if enddate %} - <span class="end-date">{{ enddate|date(date_format) }}</span>{% endif %}
</div>
{% endif %}
{% if showTitle %}
<div class="title fw-bold">{{ object.title }}</div>
{% endif %}
{% if object.subtitle %}
<div class="subtitle speaker">{{ 'EVENTS.LABELS.SUBTITLE'|t }}: {{ object.subtitle }}</div>
{% endif %}
{% if object.location %}
<div class="location">{{ 'EVENTS.LABELS.LOCATION'|t }}: {{ object.location }}</div>
{% endif %}
{% if object.start_time or object.end_time %}
<div class="time">{{ 'EVENTS.LABELS.TIME'|t }}: {{ object.start_time }}{% if object.end_time %} - {{ object.end_time }}{% endif %}</div>
{% endif %}
{% if content.summary or content.readmore %}
<div class="description mt-3">
{{ typoMacros.processContent(content.all) }}
</div>
{% endif %}
{% endset %}
{% set moduleContent %}
{% if image %}
{% if imageMode == 'zoom' %}
{% set aspectRatio = 4/3 %}
{% set imageWidth = options.gridStyle == 'vertical' ? 1280 : 1280 * options.moduleWidth / 12 %}
{{ image.cropZoom(imageWidth, imageWidth/aspectRatio).html(imageTitle,imageAlt,imageClasses)|raw }}
{% else %}
{{ image.cropResize(600, 600).html(imageTitle, imageAlt, imageClasses)|raw }}
{% endif %}
{% endif %}
{% endset %}
<script>
console.log({
current_date: {{ currentdate|json_encode|raw }},
start_date: {{ startdate|json_encode|raw }},
end_date: {{ enddate|json_encode|raw }},
past_event: {{ pastEvent|json_encode|raw }},
future_event: {{ futureEvent|json_encode|raw }},
show_past_events: {{ header.options.showPastEvents|json_encode|raw }},
show_current_events: {{ header.options.showCurrentEvents|json_encode|raw }},
show_future_events: {{ header.options.showFutureEvents|json_encode|raw }},
referencedate: {{ referencedate|json_encode|raw }},
object: {{ object|json_encode|raw }}
});
</script>
{# Embed content #}
{% block embedded_content %}
{% embed 'embeds/content-grid.html.twig' with {title: object.title} %}
{% block page_content %} {{ pageContent }} {% endblock %}
{% block module_content %} {{ moduleContent }} {% endblock %}
{% endembed %}
{% endblock %}
Thank you for your help!