From 6aae51ed27513c9743268302708231387bc13fbe Mon Sep 17 00:00:00 2001 From: s0600204 Date: Thu, 16 Jan 2020 23:57:37 +0000 Subject: [PATCH] Use ISO Year within WEEKLY recurrence handling When setting the date for an occurrence of a recurring event where the `RRULE` has a frequency of `WEEKLY` and `BYDAY` was used, the `setISODate()` method is used. Unfortunately, I had used `Y` instead of `o` as the date format code for getting the current year, thus feeding the Gregorian year instead of the ISO year into the method. This was causing some year-start/end edge-case errors, as described in #251. Essentially, I was committing the opposite of the error that Twitter is thought to have made in late 2014, as described in this video by Tom Scott: https://www.youtube.com/watch?v=D3jxx8Yyw1c (They should have used Gregorian and were using ISO, we should have been using ISO and were using Gregorian.) --- src/ICal/ICal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ICal/ICal.php b/src/ICal/ICal.php index 515bbee..cc77392 100644 --- a/src/ICal/ICal.php +++ b/src/ICal/ICal.php @@ -1397,7 +1397,7 @@ function ($weekday) use ($initialDayOfWeek, $wkstTransition, $interval) { foreach ($matchingDays as $day) { $clonedDateTime = clone $frequencyRecurringDateTime; $candidateDateTimes[] = $clonedDateTime->setISODate( - $frequencyRecurringDateTime->format('Y'), + $frequencyRecurringDateTime->format('o'), $frequencyRecurringDateTime->format('W'), $day );