The openTime
data is being stored as a numerically-indexed array. You may even want to create a mapping of those days to make rendering each day easier:
{% set days = {
0: 'Sunday',
1: 'Monday',
2: 'Tuesday',
3: 'Wednesday',
4: 'Thursday',
5: 'Friday',
6: 'Saturday'
} %}
Then you can adjust your for
loop like this:
{% for dayIndex,openTime in entry.openTimes %}
{% set day = days[dayIndex] %}
{% set hours = openTime.open|date('g:i a') ~ ' - ' ~ openTime.close|date('g:i a') %}
{{ day }}: {{ hours }}<br/>
{% endfor %}
Pro Tip:
If you have dev mode enabled, you can use dump
to see what a variable contains.
{{ dump(anyVariable) }}
That's how I figured out the underlying structure of the openTime
data.