diff options
author | Georg Ehrke <developer@georgehrke.com> | 2019-09-16 15:47:42 +0200 |
---|---|---|
committer | Backportbot <backportbot-noreply@rullzer.com> | 2019-09-17 08:07:16 +0000 |
commit | d0ee7980610407fe251907ff8420af66dbd69d9b (patch) | |
tree | 22dc0cf01cd94854d4bcdd405b171b27dd8cf5d4 | |
parent | 2fd5507624b9f0fb2a6bf95d4c0e1d4d72f3d7fd (diff) | |
download | nextcloud-server-d0ee7980610407fe251907ff8420af66dbd69d9b.tar.gz nextcloud-server-d0ee7980610407fe251907ff8420af66dbd69d9b.zip |
Sabre/VObject returns a DateAndOrTime object now, so adapt to it in Birthday service
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
-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']); } } } |