BirthdayCalendar: fix issue with birthyear to high when birthday on Dec 31st
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
This commit is contained in:
parent
50929751b0
commit
44f55fe415
|
@ -1,10 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
||||||
|
* @copyright Copyright (c) 2016, Georg Ehrke
|
||||||
*
|
*
|
||||||
* @author Achim Königs <garfonso@tratschtante.de>
|
* @author Achim Königs <garfonso@tratschtante.de>
|
||||||
* @author Robin Appelman <robin@icewind.nl>
|
* @author Robin Appelman <robin@icewind.nl>
|
||||||
* @author Thomas Müller <thomas.mueller@tmit.eu>
|
* @author Thomas Müller <thomas.mueller@tmit.eu>
|
||||||
|
* @author Georg Ehrke <georg@nextcloud.com>
|
||||||
*
|
*
|
||||||
* @license AGPL-3.0
|
* @license AGPL-3.0
|
||||||
*
|
*
|
||||||
|
@ -147,6 +149,8 @@ class BirthdayService {
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$summary = $title . ' (' . $summarySymbol . $date->format('Y') . ')';
|
||||||
$vCal = new VCalendar();
|
$vCal = new VCalendar();
|
||||||
$vCal->VERSION = '2.0';
|
$vCal->VERSION = '2.0';
|
||||||
$vEvent = $vCal->createComponent('VEVENT');
|
$vEvent = $vCal->createComponent('VEVENT');
|
||||||
|
@ -163,7 +167,7 @@ class BirthdayService {
|
||||||
$vEvent->DTEND['VALUE'] = 'DATE';
|
$vEvent->DTEND['VALUE'] = 'DATE';
|
||||||
$vEvent->{'UID'} = $doc->UID;
|
$vEvent->{'UID'} = $doc->UID;
|
||||||
$vEvent->{'RRULE'} = 'FREQ=YEARLY';
|
$vEvent->{'RRULE'} = 'FREQ=YEARLY';
|
||||||
$vEvent->{'SUMMARY'} = $title . ' (' . $summarySymbol . $date->format('Y') . ')';
|
$vEvent->{'SUMMARY'} = $summary;
|
||||||
$vEvent->{'TRANSP'} = 'TRANSPARENT';
|
$vEvent->{'TRANSP'} = 'TRANSPARENT';
|
||||||
$alarm = $vCal->createComponent('VALARM');
|
$alarm = $vCal->createComponent('VALARM');
|
||||||
$alarm->add($vCal->createProperty('TRIGGER', '-PT0M', ['VALUE' => 'DURATION']));
|
$alarm->add($vCal->createProperty('TRIGGER', '-PT0M', ['VALUE' => 'DURATION']));
|
||||||
|
|
|
@ -240,6 +240,7 @@ class BirthdayServiceTest extends TestCase {
|
||||||
[true, "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nBDAY:\r\nEND:VCARD\r\n", "Dr. Foo Bar"],
|
[true, "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nBDAY:\r\nEND:VCARD\r\n", "Dr. Foo Bar"],
|
||||||
[true, "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nBDAY:someday\r\nEND:VCARD\r\n", "Dr. Foo Bar"],
|
[true, "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nBDAY:someday\r\nEND:VCARD\r\n", "Dr. Foo Bar"],
|
||||||
[false, "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nBDAY:1900-01-01\r\nEND:VCARD\r\n", "Dr. Foo Bar"],
|
[false, "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nBDAY:1900-01-01\r\nEND:VCARD\r\n", "Dr. Foo Bar"],
|
||||||
|
[false, "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 4.1.1//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nBDAY:1900-12-31\r\nEND:VCARD\r\n", "Dr. Foo Bar"],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue