<p><strong><em>UPDATE: This issue has been fixed as of Calendar 1.8.4 on April 21, 2017.</em></strong>
<a href="https://solspace.com/craft/calendar" rel="nofollow noreferrer">https://solspace.com/craft/calendar</a></p>

<p>Your above code should work. I think there might be a bug with the <code>loadOccurrences: false</code> parameter used in conjunction with the <code>limit: 3</code> parameter. Try increasing the limit to something higher and see if you get results. :)</p>

<p>In the meantime, I've logged this bug and we'll have a bug fix for this in the near future. Sorry for the inconvenience.</p>

CC BY-SA 3.0
2017-04-18T12:55:49.210Z
I get results, but not from the specified time range. Maybe that helps solve the bug?
Paul
CC BY-SA 3.0
2017-04-21T04:49:59.717Z
Try downloading the latest version of Calendar to resolve this issue :)
Solspace
CC BY-SA 3.0
2017-04-14T02:22:31.270Z
2017-04-21T04:49:34.923Z
2017-04-21T04:49:34.923Z
Solspace
<p>I'm trying to achieve the following (without much luck), using Solspace Calendar plugin:</p>

<ul>
<li>All events (no calendar specified)</li>
<li>A defined timeframe (one week)</li>
<li>Only unique events, that have at least 1 occurrence in that week, so no reoccurrences</li>
<li>In a random order</li>
<li>Limited to a specified number</li>
</ul>

<p>I tried, without satisfying result:</p>

<pre><code>{% set events = craft.calendar.events({
    dateRangeStart: now |date('Y-m-d'),
    dateRangeEnd: now |date_modify('+7 days') |date('Y-m-d'),
    order: 'RAND()',
    loadOccurrences: false,
    limit: 3,
}) %}
</code></pre>

<p>Any Calendar experts out there?</p>

<templating><plugins><plugin-solspacecalendar>
Using Solspace Craft Calendar plugin, how can I get random events within a defined timeframe?
# Using Solspace Craft Calendar plugin, how can I get random events within a defined timeframe?

(Asked by: username_0 on 2017-04-10)

I'm trying to achieve the following (without much luck), using Solspace Calendar plugin:

All events (no calendar specified)
A defined timeframe (one week)
Only unique events, that have at least 1 occurrence in that week, so no reoccurrences
In a random order
Limited to a specified number

I tried, without satisfying result:
{% set events = craft.calendar.events({
    dateRangeStart: now |date('Y-m-d'),
    dateRangeEnd: now |date_modify('+7 days') |date('Y-m-d'),
    order: 'RAND()',
    loadOccurrences: false,
    limit: 3,
}) %}

Any Calendar experts out there?

**Tags:** templating, plugins, plugin-solspacecalendar

---

## 1 answers

### Answer by username_1 on 2017-04-14. Score: 2 | Accepted answer

***UPDATE: This issue has been fixed as of Calendar 1.8.4 on April 21, 2017.***
<https://solspace.com/craft/calendar>

Your above code should work. I think there might be a bug with the `loadOccurrences: false` parameter used in conjunction with the `limit: 3` parameter. Try increasing the limit to something higher and see if you get results. :)

In the meantime, I've logged this bug and we'll have a bug fix for this in the near future. Sorry for the inconvenience.

> **Comments:**
> **username_0**: I get results, but not from the specified time range. Maybe that helps solve the bug?  
> **username_1**: Try downloading the latest version of Calendar to resolve this issue :)  

---

