Skip to content

Commit 0089c8d

Browse files
fix: Add sabre vobject rdate patch
Signed-off-by: SebastianKrupinski <[email protected]>
1 parent a030dd6 commit 0089c8d

File tree

5 files changed

+59
-2
lines changed

5 files changed

+59
-2
lines changed

.patches/sabre-vobject-rdate.patch

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
From 099a37744a3aaf368bdd339f9c01e34553e8828e Mon Sep 17 00:00:00 2001
2+
From: SebastianKrupinski <[email protected]>
3+
Date: Wed, 19 Nov 2025 19:19:32 -0500
4+
Subject: [PATCH] fix: use RDATE in time range check and use all instances
5+
6+
Signed-off-by: SebastianKrupinski <[email protected]>
7+
---
8+
lib/Component/VEvent.php | 2 +-
9+
lib/Recur/EventIterator.php | 6 ++++-
10+
tests/VObject/Component/VEventTest.php | 35 ++++++++++++++++++++++++++
11+
3 files changed, 41 insertions(+), 2 deletions(-)
12+
13+
diff --git a/lib/Component/VEvent.php b/lib/Component/VEvent.php
14+
index e29e56322..6ca196d66 100644
15+
--- a/lib/Component/VEvent.php
16+
+++ b/lib/Component/VEvent.php
17+
@@ -41,7 +41,7 @@ class VEvent extends VObject\Component
18+
*/
19+
public function isInTimeRange(\DateTimeInterface $start, \DateTimeInterface $end): bool
20+
{
21+
- if ($this->RRULE) {
22+
+ if ($this->RRULE || $this->RDATE) {
23+
try {
24+
$it = new EventIterator($this, null, $start->getTimezone());
25+
} catch (NoInstancesException $e) {
26+
diff --git a/lib/Recur/EventIterator.php b/lib/Recur/EventIterator.php
27+
index 2c93bcf4e..79a070ee4 100644
28+
--- a/lib/Recur/EventIterator.php
29+
+++ b/lib/Recur/EventIterator.php
30+
@@ -164,8 +164,12 @@ public function __construct($input, ?string $uid = null, ?\DateTimeZone $timeZon
31+
}
32+
33+
if (isset($this->masterEvent->RDATE)) {
34+
+ $rdateValues = [];
35+
+ foreach ($this->masterEvent->RDATE as $rdate) {
36+
+ $rdateValues = array_merge($rdateValues, $rdate->getParts());
37+
+ }
38+
$this->recurIterator = new RDateIterator(
39+
- $this->masterEvent->RDATE->getParts(),
40+
+ $rdateValues,
41+
$this->startDate
42+
);
43+
} elseif (isset($this->masterEvent->RRULE)) {

composer.patches.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
},
77
"sabre/dav": {
88
"Check for instanceof INode instead of Node": ".patches/check-for-instanceof-INode-instead-of-Node-1595.patch"
9+
},
10+
"sabre/vobject": {
11+
"fix use RDATE in time range check and use all instances": ".patches/sabre-vobject-rdate.patch"
912
}
1013
}
1114
}

sabre/vobject/PATCHES.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
This file was automatically generated by Composer Patches (https://github.com/cweagans/composer-patches)
2+
Patches applied to this directory:
3+
4+
fix use RDATE in time range check and use all instances
5+
Source: .patches/sabre-vobject-rdate.patch
6+
7+

sabre/vobject/lib/Component/VEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class VEvent extends VObject\Component
2929
*/
3030
public function isInTimeRange(DateTimeInterface $start, DateTimeInterface $end)
3131
{
32-
if ($this->RRULE) {
32+
if ($this->RRULE || $this->RDATE) {
3333
try {
3434
$it = new EventIterator($this, null, $start->getTimezone());
3535
} catch (NoInstancesException $e) {

sabre/vobject/lib/Recur/EventIterator.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,12 @@ public function __construct($input, $uid = null, ?DateTimeZone $timeZone = null)
168168
}
169169

170170
if (isset($this->masterEvent->RDATE)) {
171+
$rdateValues = [];
172+
foreach ($this->masterEvent->RDATE as $rdate) {
173+
$rdateValues = array_merge($rdateValues, $rdate->getParts());
174+
}
171175
$this->recurIterator = new RDateIterator(
172-
$this->masterEvent->RDATE->getParts(),
176+
$rdateValues,
173177
$this->startDate
174178
);
175179
} elseif (isset($this->masterEvent->RRULE)) {

0 commit comments

Comments
 (0)