File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ public function __construct($rrule, DateTimeInterface $start)
3232 $ this ->startDate = $ start ;
3333 $ this ->parseRDate ($ rrule );
3434 array_unshift ($ this ->dates , DateTimeImmutable::createFromInterface ($ this ->startDate ));
35+ sort ($ this ->dates );
36+ $ this ->dates = array_values ($ this ->dates );
3537 $ this ->rewind ();
3638 }
3739
@@ -43,13 +45,6 @@ public function current()
4345 if (!$ this ->valid ()) {
4446 return null ;
4547 }
46- if (is_string ($ this ->dates [$ this ->counter ])) {
47- $ this ->dates [$ this ->counter ] =
48- DateTimeParser::parse (
49- $ this ->dates [$ this ->counter ],
50- $ this ->startDate ->getTimezone ()
51- );
52- }
5348 return $ this ->dates [$ this ->counter ];
5449 }
5550
@@ -155,8 +150,13 @@ protected function parseRDate($rdate)
155150 if (is_string ($ rdate )) {
156151 $ rdate = explode (', ' , $ rdate );
157152 }
158-
159- $ this ->dates = $ rdate ;
153+ $ this ->dates = array_map (
154+ fn (string $ dateString ) => DateTimeParser::parse (
155+ $ dateString ,
156+ $ this ->startDate ->getTimezone ()
157+ ),
158+ $ rdate
159+ );
160160 }
161161
162162 /**
You can’t perform that action at this time.
0 commit comments