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)) {