From: Michael J. Rubinsky Date: Mon, 7 Jun 2010 13:48:05 +0000 (-0400) Subject: It's also possible to be in month 1, while in ISO week 52. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=477b883efa5257115fa0453a9cb87aa8fe0d29a8;p=horde.git It's also possible to be in month 1, while in ISO week 52. Fixes Bug: 8799 --- 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;