File tree 2 files changed +51
-1
lines changed
2 files changed +51
-1
lines changed Original file line number Diff line number Diff line change @@ -610,7 +610,11 @@ protected function nextYearly(): void
610
610
// If we advanced to the next month or year, the first
611
611
// occurrence is always correct.
612
612
if ($ occurrence > $ currentDayOfMonth || $ advancedToNewMonth ) {
613
- break 2 ;
613
+ // only consider byMonth matches,
614
+ // otherwise, we don't follow RRule correctly
615
+ if (in_array ($ currentMonth , $ this ->byMonth )) {
616
+ break 2 ;
617
+ }
614
618
}
615
619
}
616
620
Original file line number Diff line number Diff line change @@ -922,6 +922,52 @@ public function testYearlyBySetPosLoop(): void
922
922
);
923
923
}
924
924
925
+ /**
926
+ * This caused an incorrect date to be returned by the rule iterator when
927
+ * start date was not on the rrule list.
928
+ *
929
+ * @dataProvider yearlyStartDateNotOnRRuleListProvider
930
+ */
931
+ public function testYearlyStartDateNotOnRRuleList (string $ rule , string $ start , array $ expected ): void
932
+ {
933
+ $ this ->parse ($ rule , $ start , $ expected );
934
+ }
935
+
936
+ public function yearlyStartDateNotOnRRuleListProvider (): array
937
+ {
938
+ return [
939
+ [
940
+ 'FREQ=YEARLY;BYMONTH=6;BYDAY=-1FR;UNTIL=20250901T000000Z ' ,
941
+ '2023-09-01 12:00:00 ' ,
942
+ [
943
+ '2023-09-01 12:00:00 ' ,
944
+ '2024-06-28 12:00:00 ' ,
945
+ '2025-06-27 12:00:00 ' ,
946
+ ],
947
+ ],
948
+ [
949
+ 'FREQ=YEARLY;BYMONTH=6;BYDAY=-1FR;UNTIL=20250901T000000Z ' ,
950
+ '2023-06-01 12:00:00 ' ,
951
+ [
952
+ '2023-06-01 12:00:00 ' ,
953
+ '2023-06-30 12:00:00 ' ,
954
+ '2024-06-28 12:00:00 ' ,
955
+ '2025-06-27 12:00:00 ' ,
956
+ ],
957
+ ],
958
+ [
959
+ 'FREQ=YEARLY;BYMONTH=6;BYDAY=-1FR;UNTIL=20250901T000000Z ' ,
960
+ '2023-05-01 12:00:00 ' ,
961
+ [
962
+ '2023-05-01 12:00:00 ' ,
963
+ '2023-06-30 12:00:00 ' ,
964
+ '2024-06-28 12:00:00 ' ,
965
+ '2025-06-27 12:00:00 ' ,
966
+ ],
967
+ ],
968
+ ];
969
+ }
970
+
925
971
/**
926
972
* Something, somewhere produced an ics with an interval set to 0. Because
927
973
* this means we increase the current day (or week, month) by 0, this also
You can’t perform that action at this time.
0 commit comments