From a7465ab42d35bff4c765d88f428193b491cf8b2f Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 5 Mar 2024 11:48:28 +0100 Subject: [PATCH] fix birthday --- src/Mapper/ContactApiToEntityMapper.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Mapper/ContactApiToEntityMapper.php b/src/Mapper/ContactApiToEntityMapper.php index 931cef0..7129a65 100644 --- a/src/Mapper/ContactApiToEntityMapper.php +++ b/src/Mapper/ContactApiToEntityMapper.php @@ -57,7 +57,10 @@ class ContactApiToEntityMapper implements MapperInterface $entity->setFirstName($dto->firstName); $entity->setLastName($dto->lastName); - $entity->setBirthday($dto->birthday); + $birthDay = $dto->birthday !== null ? + \DateTimeImmutable::createFromFormat('Y-m-d', $dto->birthday) : + null; + $entity->setBirthday($birthDay); $entity->setImage($dto->image); $entity->setPosition($dto->position); $entity->setPhone($dto->phone);