Skip to content

Commit

Permalink
Bug: 12869 Fix importing RRULE UNTIL values when they contain date pa…
Browse files Browse the repository at this point in the history
…rts.

We were already treating UNTIL as inclusive as well as comparing them by datetime
(as opposed to date). The problem was we weren't importing the time portion
of the UNTIL value if it was present.
  • Loading branch information
mrubinsk committed Dec 6, 2013
1 parent b481e70 commit 2fec6b8
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions framework/Date/lib/Horde/Date/Recurrence.php
Expand Up @@ -1123,13 +1123,23 @@ public function fromRRule20($rrule)
break;
}

// MUST take into account the time portion if it is present.
// See Bug: 12869 and Bug: 2813
if (isset($rdata['UNTIL'])) {
list($year, $month, $mday) = sscanf($rdata['UNTIL'],
'%04d%02d%02d');
$this->setRecurEnd(new Horde_Date(array('year' => $year,
'month' => $month,
'mday' => $mday),
$this->start->timezone));
if (preg_match('/^(\d{4})-?(\d{2})-?(\d{2})T? ?(\d{2}):?(\d{2}):?(\d{2})(?:\.\d+)?(Z?)$/', $rdata['UNTIL'], $parts)) {
$until = new Horde_Date($rdata['UNTIL'], 'UTC');
$until->setTimezone($this->start->timezone);
} else {
list($year, $month, $mday) = sscanf($rdata['UNTIL'],
'%04d%02d%02d');
$until = new Horde_Date(
array('year' => $year,
'month' => $month,
'mday' => $mday),
$this->start->timezone
);
}
$this->setRecurEnd($until);
}
if (isset($rdata['COUNT'])) {
$this->setRecurCount($rdata['COUNT']);
Expand Down

0 comments on commit 2fec6b8

Please sign in to comment.