From 5408f197fda0241108d940b979bbfa0e59d01caa Mon Sep 17 00:00:00 2001 From: OpenXE <> Date: Mon, 7 Aug 2023 14:57:45 +0200 Subject: [PATCH] improved date format conversion with exception on ticket import with wrongly specified date --- classes/Components/MailClient/Data/MailMessageData.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/classes/Components/MailClient/Data/MailMessageData.php b/classes/Components/MailClient/Data/MailMessageData.php index bab8f8d9..f0099501 100644 --- a/classes/Components/MailClient/Data/MailMessageData.php +++ b/classes/Components/MailClient/Data/MailMessageData.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Xentral\Components\MailClient\Data; use DateTime; +use DateTimeImmutable; use DateTimeInterface; use JsonSerializable; use Throwable; @@ -307,11 +308,13 @@ final class MailMessageData implements MailMessageInterface, JsonSerializable if ($date === null) { return null; } - $dateTime = date_create($date->getValue()); +/* $dateTime = date_create($date->getValue()); if ($dateTime === false) { throw new InvalidArgumentException('Invalid date: '.$date->getValue()); return null; - } + }*/ + + $dateTime = new DateTimeImmutable($date->getValue()); return $dateTime; }