Skip to content

Commit 9b78d02

Browse files
Fix to allow string dates in typescript-node generator
1 parent 89a108a commit 9b78d02

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • modules/openapi-generator/src/main/resources/typescript-node

modules/openapi-generator/src/main/resources/typescript-node/models.mustache

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ export class ObjectSerializer {
151151
}
152152
return transformedData;
153153
} else if (type === "Date") {
154+
if (typeof data === "string") {
155+
return new Date(data).toISOString();
156+
}
154157
return data.toISOString();
155158
} else {
156159
if (enumsMap[type]) {

0 commit comments

Comments
 (0)