Permalink
Browse files

Merging from HEAD:

Repeat events are now created correctly even if the DST change boundary
is crossed between repeats.
  • Loading branch information...
1 parent 65ebc47 commit 4dde75c7d738825203d7aee45ae9214358c7682c defacer committed Aug 23, 2005
Showing with 8 additions and 3 deletions.
  1. +8 −3 calendar/event.php
View
@@ -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.

0 comments on commit 4dde75c

Please sign in to comment.