Is there a way to get the first and last days of a multi-day event? I want to be able to style the first and last days differently. I don't see anything like this in the docs.

This is in Craft 3 and Calendar 2.0.17

1 Answer 1


Within the context of calendar.month, if you check out the demo templates, we style the beginning and end of multi-day events with the following code:

{% if event.multiDay %}
    {% set classes = classes ~ " multi_day" %}
    {% set classes = classes ~ (day.containsDate(event.startDateLocalized) ? " first_day") %}
    {% set classes = classes ~ (day.containsDate(event.endDateLocalized) ? " last_day") %}
{% endif %}
  • Excellent! Thanks - I must've missed that in the demo templates.
    – A Herrera
    Commented Mar 27, 2019 at 15:51
  • This is almost fully working. The bit that doesn't work is the "first_day" class per your example. Even in the demo templates the class for the first day isn't applied. Any ideas?
    – A Herrera
    Commented Mar 27, 2019 at 21:57
  • Screenshot of the demo templates in my setup here: d.pr/i/a0T1BV
    – A Herrera
    Commented Mar 27, 2019 at 21:58
  • Perhaps try reinstalling demo templates. Multi-day events appear to display correctly for me...
    – Solspace
    Commented Mar 28, 2019 at 14:10
  • Hm, that didn't work.
    – A Herrera
    Commented Apr 1, 2019 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.