I am looking to display the dates alongside the week days on the week views in calendar module Drupal 8.
Right now i am getting the week days like Monday, but i need the day number and the month like Monday 22 December.
Something like that. In this image i’ve hooked the startDate variable and done a loop, but if i don’t have any content starting on Monday, it does not loop.
So i changed it to show just Monday to Sunday.
Conclusion: I would like to achive the same result as in the picture.
My current twig code:
<div class="calendar-calendar-schedule"><div class="week-schedule">
{% if items %}
- {% for time in items %}
{{ time.day }}{{ time.ampm }} {% set current_position = 0 %}
{% for column in columns %} {% set column_position = time.values.column[0] ? time.values.column[0].wday : loop.index %} {% set current_position = column_position + 1 %} {% set day = now|date('w') %} {% set weekStart = now|date_modify("-#{day} days")|date('d') %} <li class="schedule-calendar" > {% set weekStart = weekStart|date_modify("+#{current_position+2} days")|date('l') %} <h2>{{ weekStart }}</h2> <div class="schedule"> <div class="inner"> {% for item in time.values[column] %} {{ item.entry }} {% endfor %} </div> </div> </li> {% endfor %} {% endfor %}
{% else %} Bookings not available for this week. {% endif %}