A common need when displaying dates on a website is to display the start and end date of an event. If your date field is a standard Drupal datetime or daterange field, that's fairly easy. (See my post on how to get values from Drupal date fields in Twig).
If your date field is a Smart Date field and allows for recurrence, that's slightly more complicated, as it is now a multi-value field (essentially an array). Let's say you want to show the start and end dates for an event that runs through several weeks (or months, or whatever). You don't want to show every instance of the event, just the overall range. This should work for any multi-value field.
Just keep in mind that you can't just print out the array keys as such, you have to put a filter on them. In this case the Twig |date
filter allows them to display, but at a minimum you'd need a filter such as |join
if it isn't a date field.
{{ node.field_event_dates[0].value|date('F j, Y') }}
{% if node.field_event_dates.value|length > 1 %}
–
{{ node.field_event_dates|last.value|date('F j, Y') }}
{% endif %}
I also wrote a lot more about how to get different values from Smart Date fields.