Skip to content

Commit

Permalink
Fix recurrence end if specified as DATE value (Bug #13401).
Browse files Browse the repository at this point in the history
UNTIL properties are inclusive. If specified as DATE value we need to add one day, so we cover the whole day until 12am on the next day.
  • Loading branch information
yunosh committed Aug 1, 2014
1 parent 15ce290 commit d922e25
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion framework/Date/lib/Horde/Date/Recurrence.php
Expand Up @@ -1135,7 +1135,7 @@ public function fromRRule20($rrule)
$until = new Horde_Date(
array('year' => $year,
'month' => $month,
'mday' => $mday),
'mday' => $mday + 1),
$this->start->timezone
);
}
Expand Down
4 changes: 2 additions & 2 deletions framework/Date/package.xml
Expand Up @@ -27,7 +27,7 @@
</stability>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
*
* [jan] Fix calculating recurrence end if UNTIL property of iCalendar data is DATE value (Bug #13401).
</notes>
<contents>
<dir baseinstalldir="/" name="/">
Expand Down Expand Up @@ -1012,7 +1012,7 @@
<date>2014-07-01</date>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
*
* [jan] Fix calculating recurrence end if UNTIL property of iCalendar data is DATE value (Bug #13401).
</notes>
</release>
</changelog>
Expand Down
14 changes: 7 additions & 7 deletions framework/Date/test/Horde/Date/RecurrenceTest.php
Expand Up @@ -544,7 +544,7 @@ public function testParseDaily()
$this->assertEquals(2, $r->getRecurInterval());
$this->assertNull($r->getRecurOnDays());
$this->assertNull($r->getRecurCount());
$this->assertEquals('2007-03-07 00:00:00', (string)$r->recurEnd);
$this->assertEquals('2007-03-08 00:00:00', (string)$r->recurEnd);

$r->fromRRule20('FREQ=DAILY;INTERVAL=2;UNTIL=20070308T090000Z');
$this->assertEquals(Horde_Date_Recurrence::RECUR_DAILY, $r->getRecurType());
Expand Down Expand Up @@ -601,7 +601,7 @@ public function testParseWeekly()
$this->assertEquals(1, $r->getRecurInterval());
$this->assertEquals(Horde_Date::MASK_THURSDAY, $r->getRecurOnDays());
$this->assertNull($r->getRecurCount());
$this->assertEquals('2007-03-29 00:00:00', (string)$r->recurEnd);
$this->assertEquals('2007-03-30 00:00:00', (string)$r->recurEnd);

$r->fromRRule20('FREQ=WEEKLY;INTERVAL=1;BYDAY=TH;UNTIL=20070330T080000Z');
$this->assertEquals(Horde_Date_Recurrence::RECUR_WEEKLY, $r->getRecurType());
Expand Down Expand Up @@ -669,7 +669,7 @@ public function testParseMonthlyDate()
$this->assertEquals(1, $r->getRecurInterval());
$this->assertNull($r->getRecurOnDays());
$this->assertNull($r->getRecurCount());
$this->assertEquals('2007-05-01 00:00:00', (string)$r->recurEnd);
$this->assertEquals('2007-05-02 00:00:00', (string)$r->recurEnd);

$r->fromRRule20('FREQ=MONTHLY;INTERVAL=1;UNTIL=20070502T080000Z');
$this->assertEquals(Horde_Date_Recurrence::RECUR_MONTHLY_DATE, $r->getRecurType());
Expand Down Expand Up @@ -719,7 +719,7 @@ public function testParseMonthlyWeekday()
$this->assertEquals(1, $r->getRecurInterval());
$this->assertNull($r->getRecurOnDays());
$this->assertNull($r->getRecurCount());
$this->assertEquals('2007-05-01 00:00:00', (string)$r->recurEnd);
$this->assertEquals('2007-05-02 00:00:00', (string)$r->recurEnd);

$r->fromRRule20('FREQ=MONTHLY;INTERVAL=1;BYDAY=1TH;UNTIL=20070502T080000Z');
$this->assertEquals(Horde_Date_Recurrence::RECUR_MONTHLY_WEEKDAY, $r->getRecurType());
Expand Down Expand Up @@ -763,7 +763,7 @@ public function testParseYearlyDate()
$this->assertEquals(1, $r->getRecurInterval());
$this->assertNull($r->getRecurOnDays());
$this->assertNull($r->getRecurCount());
$this->assertEquals('2009-03-01 00:00:00', (string)$r->recurEnd);
$this->assertEquals('2009-03-02 00:00:00', (string)$r->recurEnd);

$r->fromRRule20('FREQ=YEARLY;INTERVAL=1;UNTIL=20090302T090000Z');
$this->assertEquals(Horde_Date_Recurrence::RECUR_YEARLY_DATE, $r->getRecurType());
Expand Down Expand Up @@ -807,7 +807,7 @@ public function testParseYearlyDay()
$this->assertEquals(1, $r->getRecurInterval());
$this->assertNull($r->getRecurOnDays());
$this->assertNull($r->getRecurCount());
$this->assertEquals('2009-03-01 00:00:00', (string)$r->recurEnd);
$this->assertEquals('2009-03-02 00:00:00', (string)$r->recurEnd);

$r->fromRRule20('FREQ=YEARLY;INTERVAL=1;BYYEARDAY=60;UNTIL=20090302T090000Z');
$this->assertEquals(Horde_Date_Recurrence::RECUR_YEARLY_DAY, $r->getRecurType());
Expand All @@ -831,7 +831,7 @@ public function testParseYearlyWeekday()
$this->assertEquals(1, $r->getRecurInterval());
$this->assertNull($r->getRecurOnDays());
$this->assertNull($r->getRecurCount());
$this->assertEquals('2009-03-01 00:00:00', (string)$r->recurEnd);
$this->assertEquals('2009-03-02 00:00:00', (string)$r->recurEnd);

$r->fromRRule20('FREQ=YEARLY;INTERVAL=1;BYDAY=1TH;BYMONTH=3;UNTIL=20090302T090000Z');
$this->assertEquals(Horde_Date_Recurrence::RECUR_YEARLY_WEEKDAY, $r->getRecurType());
Expand Down

0 comments on commit d922e25

Please sign in to comment.