Skip to content

Commit 9cc893d

Browse files
committed
fix(typescript): add Date instance check before date formatting
1 parent bfc989c commit 9cc893d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

modules/openapi-generator/src/main/resources/typescript/model/ObjectSerializer.mustache

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ export class ObjectSerializer {
177177
}
178178
return transformedData;
179179
} else if (type === "Date") {
180+
if (!(data instanceof Date)) {
181+
return data;
182+
}
180183
if (format == "date") {
181184
let month = data.getMonth()+1
182185
month = month < 10 ? "0" + month.toString() : month.toString()

0 commit comments

Comments
 (0)