diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index 5b69d522545f1..e4f93b8e2bd7b 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -780,6 +780,9 @@ public function createShare( $share->setSharedWith($shareWith); $share->setPermissions($permissions); if ($expireDate !== '') { + if ($expireDate instanceof \DateTime) { + $expireDate = $expireDate->format('Y-m-d'); + } try { $expireDate = $this->parseDate($expireDate); $share->setExpirationDate($expireDate); @@ -801,6 +804,9 @@ public function createShare( $share->setSharedWith($shareWith); $share->setPermissions($permissions); if ($expireDate !== '') { + if ($expireDate instanceof \DateTime) { + $expireDate = $expireDate->format('Y-m-d'); + } try { $expireDate = $this->parseDate($expireDate); $share->setExpirationDate($expireDate); @@ -845,6 +851,9 @@ public function createShare( //Expire date if ($expireDate !== '') { + if ($expireDate instanceof \DateTime) { + $expireDate = $expireDate->format('Y-m-d'); + } try { $expireDate = $this->parseDate($expireDate); $share->setExpirationDate($expireDate); @@ -1384,6 +1393,9 @@ public function updateShare( if ($expireDate === '') { $share->setExpirationDate(null); } elseif ($expireDate !== null) { + if ($expireDate instanceof \DateTime) { + $expireDate = $expireDate->format('Y-m-d'); + } try { $expireDate = $this->parseDate($expireDate); } catch (\Exception $e) {