I have linked my calendar with Home Assistant, and correctly got a calendar entity. I can nicely display a list of events within a certain range using the Calendar card.
However, I would like to display a list of events only on the upcoming weekends (e.g events on the next 4 weekends, saturdays and sundays). I know that I can run the calendar.get_events action:
I am not the best in jinja, but I would do something like this:
{% set events = agenda['calendar.my_calendar']['events'] %}
{% set ns = namespace(ev_weekend=[]) %}
{% for ev in events %}
{% if as_timestamp(ev.start)| timestamp_custom('%w')|int in (0,6) %}
{% set ns.ev_weekend=ns.ev_weekend + [ev] %}
{% endif %}
{% endfor %}
{{ ns.ev_weekend }}
By no means a good way of doing it but this could be used.
Loop through the individual days of the event and if that day is 0 or 6 then its true.
{% set start = as_timestamp("2026-02-19T18:00:00+00:00")| timestamp_custom('%w') | int %}
{% set end = as_timestamp("2026-02-24T18:00:00+00:00") | timestamp_custom('%w') | int %}
{{ start}}
{{end }}
if it's past the weekend two loops is needed
{% if start > end %}
{% for a in range(start, max(end+1,7)) %}
{{a in (0,6)}}
{% endfor %}
{% for a in range(0, end+1) %}
{{a in (0,6)}}
{% endfor %}
{% else %}
{% for a in range(start, end+1) %}
{{a in (0,6)}}
{% endfor %}
{% endif %}