diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2019-09-19 21:31:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-19 21:31:24 +0200 |
commit | db51d166b761bc06673c0508caec1b0d81a7bb7f (patch) | |
tree | aa2b216c81ce693877325b148d3f2c5c540ea11e /apps/dav/lib/CalDAV | |
parent | 8f43f5973b8756fe53e90df53900d6b5619573a2 (diff) | |
parent | d0ee7980610407fe251907ff8420af66dbd69d9b (diff) | |
download | nextcloud-server-db51d166b761bc06673c0508caec1b0d81a7bb7f.tar.gz nextcloud-server-db51d166b761bc06673c0508caec1b0d81a7bb7f.zip |
Merge pull request #17172 from nextcloud/backport/17159/stable17
[stable17] Sabre/VObject returns a DateAndOrTime object now, so adapt to it in Birthday service
Diffstat (limited to 'apps/dav/lib/CalDAV')
-rw-r--r-- | apps/dav/lib/CalDAV/BirthdayService.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/apps/dav/lib/CalDAV/BirthdayService.php b/apps/dav/lib/CalDAV/BirthdayService.php index 278373733a4..a4326f54f64 100644 --- a/apps/dav/lib/CalDAV/BirthdayService.php +++ b/apps/dav/lib/CalDAV/BirthdayService.php @@ -243,7 +243,11 @@ class BirthdayService { } try { - $date = new \DateTime($birthday); + if ($birthday instanceof DateAndOrTime) { + $date = $birthday->getDateTime(); + } else { + $date = new \DateTimeImmutable($birthday); + } } catch (Exception $e) { return null; } @@ -259,10 +263,13 @@ class BirthdayService { ); $vEvent->DTSTART['VALUE'] = 'DATE'; $vEvent->add('DTEND'); - $date->add(new \DateInterval('P1D')); + + $dtEndDate = (new \DateTime())->setTimestamp($date->getTimeStamp()); + $dtEndDate->add(new \DateInterval('P1D')); $vEvent->DTEND->setDateTime( - $date + $dtEndDate ); + $vEvent->DTEND['VALUE'] = 'DATE'; $vEvent->{'UID'} = $doc->UID . $postfix; $vEvent->{'RRULE'} = 'FREQ=YEARLY'; @@ -306,7 +313,7 @@ class BirthdayService { foreach($books as $book) { $cards = $this->cardDavBackEnd->getCards($book['id']); foreach($cards as $card) { - $this->onCardChanged($book['id'], $card['uri'], $card['carddata']); + $this->onCardChanged((int) $book['id'], $card['uri'], $card['carddata']); } } } |