From 4dde75c7d738825203d7aee45ae9214358c7682c Mon Sep 17 00:00:00 2001 From: defacer Date: Tue, 23 Aug 2005 20:08:21 +0000 Subject: [PATCH] Merging from HEAD: Repeat events are now created correctly even if the DST change boundary is crossed between repeats. --- calendar/event.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/calendar/event.php b/calendar/event.php index 4cfefdc182e..20d533e6948 100644 --- a/calendar/event.php +++ b/calendar/event.php @@ -216,9 +216,14 @@ if ($form->repeat) { for($i = 1; $i < $form->repeats; $i++) { - // [pj] - // This will not necessarily work correctly because of DST - $form->timestart += 604800; // add one week + // What's the DST offset for the previous repeat? + $dst_offset_prev = dst_offset_on($form->timestart); + + $form->timestart += WEEKSECS; + + // If the offset has changed in the meantime, update this repeat accordingly + $form->timestart += $dst_offset_prev - dst_offset_on($form->timestart); + /// Get the event id for the log record. $eventid = insert_record('event', $form, true); /// Log the event entry.