From 9a49ec5567966f3c71de91df44c495ce42087731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20S?= Date: Fri, 5 Apr 2024 13:46:25 +0200 Subject: [PATCH] fix(php): Fix date formatting in ObjectSerializer::sanitizeForSerialization() --- templates/php/src/ObjectSerializer.mustache | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/php/src/ObjectSerializer.mustache b/templates/php/src/ObjectSerializer.mustache index 86874cc5..8b39d2d1 100644 --- a/templates/php/src/ObjectSerializer.mustache +++ b/templates/php/src/ObjectSerializer.mustache @@ -45,7 +45,9 @@ class ObjectSerializer } if ($data instanceof \DateTime) { - return ($format === 'date') ? $data->format('Y-m-d') : $data->format(self::$dateTimeFormat); + return ($type === 'date' || $format === 'date') + ? $data->format('Y-m-d') + : $data->format(self::$dateTimeFormat); } if (is_array($data)) {