I have events that are presented by month. Right now they are being separated by Month but the heading for each chunk shows January as the month for each one. Not sure why, or how to fix it, am interested in understanding both. I am somewhat new to craft.
<div class="container">
{% if entry.heading is defined %}<h1>{{ entry.heading }}</h1>{% endif %}
{% set allEntries = craft.entries.section('tours').find() %}
{% set allEntriesByMonth = allEntries|group('entryDate.month') %}
{% for month, entriesInMonth in allEntriesByMonth %}
<h2>{{entry.entryDate|date('M')}}</h2>
{% for entry in entriesInMonth %}
<div class="row" style="padding-bottom: 25px;">
<div class="col-md-12">
<div style="border-bottom: 1px solid #d4d4d4;width:100%;">
<p>{{entry.entryDate.month}}.{{entry.entryDate.day}}.{{entry.entryDate.year}} - {{entry.locationCity}}, {{entry.locationState}} <a href="/tours/{{entry.slug}}" class="btn btn-primary btn-md" style="float:right;">register</a></p>
</div>
</div>
</div>
{% endfor %}
{% endfor%}
I am trying to adjust the h2
with |date('M')
in order to display the date as text. If I do not do that it displays the correct month number, but when I try to format it it breaks and displays the same month for all entries even though it is still ordering them. So how can I format this to show month as text without breaking it?
Any attempt to format the date breaks it. The dates below should be september and october.
entry.entryDate
formatted? Maybe the output isn't what the date filter expects? – megatrond Sep 3 '15 at 20:53