Skip to content

Commit 11f4cba

Browse files
authored
Document event parameter (#172)
1 parent af11667 commit 11f4cba

2 files changed

Lines changed: 31 additions & 5 deletions

File tree

DOCUMENTATION.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ sort="desc"
198198
Returns events within a date range.
199199

200200
**Parameters:**
201-
- `collection` (optional)
201+
- `collection` (optional, defaults to 'events')
202+
- `event` (optional) Pass `id` of the event you want occurrences for
202203
- `from` (optional, defaults to now)
203204
- `to` (required)
204205

@@ -219,6 +220,10 @@ Additional flags:
219220

220221
Returns events within a future time window.
221222

223+
**Parameters:**
224+
- `collection` (optional, defaults to 'events')
225+
- `event` (optional) Pass `id` of the event you want occurrences for
226+
222227
Example:
223228

224229
```antlers
@@ -229,24 +234,29 @@ next="90 days"
229234

230235
Returns events occurring today.
231236

232-
Optional:
233-
- `ignore_past="true"`
237+
**Parameters:**
238+
- `collection` (optional, defaults to 'events')
239+
- `event` (optional) Pass `id` of the event you want occurrences for
240+
- `ignore_past` (optional, defaults to 'false')
234241

235242
### events:upcoming
236243

237244
Returns the next set of event occurrences.
238245

239246
**Parameters:**
240247
- `limit` (required)
241-
- `collection` (optional)
242-
- `event` (optional)
248+
- `collection` (optional, defaults to 'events')
249+
- `event` (optional) Pass `id` of the event you want occurrences for
243250
- `collapse_multi_days` (optional)
244251
- `offset` (optional)
245252

246253
### events:download_link
247254

248255
Generates an ICS download link.
249256

257+
**Parameters:**
258+
- `date` date get occurrences to download
259+
250260
Includes:
251261
- `location`
252262
- `description`

tests/Tags/EventsTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,22 @@
2727
$this->tag = app(EventsTag::class);
2828
});
2929

30+
test('can generate between occurrences of a specific event', function () {
31+
Carbon::setTestNow(now()->setTimeFromTimeString('10:00'));
32+
33+
$this->tag
34+
->setContext([])
35+
->setParameters([
36+
'event' => 'recurring-event',
37+
'from' => Carbon::now(),
38+
'to' => Carbon::now()->addWeek(3),
39+
]);
40+
41+
$occurrences = $this->tag->between();
42+
43+
expect($occurrences)->toHaveCount(4);
44+
});
45+
3046
test('can generate between occurrences', function () {
3147
Carbon::setTestNow(now()->setTimeFromTimeString('10:00'));
3248

0 commit comments

Comments
 (0)