From 8297bd45562f1ed263fe0cb54807f86962499afb Mon Sep 17 00:00:00 2001 From: Git'Fellow <12234510+solracsf@users.noreply.github.com> Date: Mon, 8 May 2023 14:38:22 +0200 Subject: [PATCH 1/2] fix incorrect Date format detection Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com> --- lib/Model/Circle.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Model/Circle.php b/lib/Model/Circle.php index 503e2ddc2..1f3f2627e 100644 --- a/lib/Model/Circle.php +++ b/lib/Model/Circle.php @@ -912,7 +912,9 @@ public function importFromDatabase(array $data, string $prefix = ''): IQueryRow ->setDescription($this->get($prefix . 'description', $data)); $creation = $this->get($prefix . 'creation', $data); - $this->setCreation(DateTime::createFromFormat('Y-m-d H:i:s', $creation)->getTimestamp()); + $dateTime = DateTime::createFromFormat('Y-m-d H:i:s', $creation); + $timestamp = $dateTime ? $dateTime->getTimestamp() : (int) strtotime('Y-m-d H:i:s', $creation); + $this->setCreation($timestamp); $this->setPopulation($this->getInt('population', $this->getSettings())); $this->setPopulationInherited($this->getInt('populationInherited', $this->getSettings())); From 3992bced8fa470766d09bca6100c2e0880873d92 Mon Sep 17 00:00:00 2001 From: Git'Fellow <12234510+solracsf@users.noreply.github.com> Date: Mon, 8 May 2023 18:15:29 +0200 Subject: [PATCH 2/2] Psalm fix Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com> --- lib/Model/Circle.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Model/Circle.php b/lib/Model/Circle.php index 1f3f2627e..57933f038 100644 --- a/lib/Model/Circle.php +++ b/lib/Model/Circle.php @@ -913,7 +913,7 @@ public function importFromDatabase(array $data, string $prefix = ''): IQueryRow $creation = $this->get($prefix . 'creation', $data); $dateTime = DateTime::createFromFormat('Y-m-d H:i:s', $creation); - $timestamp = $dateTime ? $dateTime->getTimestamp() : (int) strtotime('Y-m-d H:i:s', $creation); + $timestamp = $dateTime ? $dateTime->getTimestamp() : (int) strtotime($creation); $this->setCreation($timestamp); $this->setPopulation($this->getInt('population', $this->getSettings()));