Skip to content

Countdown based on calendar does not reset properly. #391

Discussion options

You must be logged in to vote

@JayGreentree

Calendar handles repeating events correctly. So the issue is within your Twig and JS.

By default, when you query craft.calendar.events, it returns base events, not individual occurrences of repeating events. You want the next upcoming occurrence, not the base event. Looking at your Gist, you are using event.startDate and this is giving you the first occurrence's date, not the next upcoming event date.

{% set events = craft.calendar.events({
    id: 'not ' ~ currentEventId,
    rangeStart: 'today',
    rangeEnd: '1 month',
    limit: 10,
    orderBy: 'startDate asc',
    loadOccurrences: true
}) %}

...

{% for event in events %}
    {% set upcomingOccurrences = event.occurre…

Replies: 12 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by kjmartens
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #380 on May 09, 2025 14:32.