From 477b883efa5257115fa0453a9cb87aa8fe0d29a8 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Mon, 7 Jun 2010 09:48:05 -0400 Subject: [PATCH] It's also possible to be in month 1, while in ISO week 52. Fixes Bug: 8799 --- framework/Date/lib/Horde/Date/Recurrence.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/framework/Date/lib/Horde/Date/Recurrence.php b/framework/Date/lib/Horde/Date/Recurrence.php index bd76fd9d5..1d475a950 100644 --- a/framework/Date/lib/Horde/Date/Recurrence.php +++ b/framework/Date/lib/Horde/Date/Recurrence.php @@ -386,13 +386,17 @@ class Horde_Date_Recurrence $start_week->sec = $this->start->sec; // Make sure we are not at the ISO-8601 first week of year while - // still in month 12...and adjust the year ahead if we are. + // still in month 12...OR in the ISO-8601 last week of year while + // in month 1 and adjust the year accordingly. $week = $after->format('W'); if ($week == 1 && $after->month == 12) { $theYear = $after->year + 1; + } elseif ($week == 52 && $after->month == 1) { + $theYear = $after->year - 1; } else { $theYear = $after->year; } + $after_week = Horde_Date_Utils::firstDayOfWeek($week, $theYear); $after_week_end = clone $after_week; $after_week_end->mday += 7; -- 2.11.0