Skip to content

Commit

Permalink
Fix Incorrect Zod Schema Generation for Datetime Fields (#4377)
Browse files Browse the repository at this point in the history
* Fix Zod schema generation for datetime fields

* Add changeset for datetime schema fix

* Set changeset to patch release

* chore: update unit test

---------

Co-authored-by: Siddharth Suresh <[email protected]>
  • Loading branch information
doe-base and siddhsuresh authored Sep 30, 2024
1 parent 2711291 commit 56bd32b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/tricky-laws-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@blitzjs/generator": patch
---

Fix Zod schema generation for datetime fields by removing extra parentheses.
2 changes: 1 addition & 1 deletion packages/generator/src/utils/get-codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const defaultCodegenConfig: CodegenConfig = {
datetime: {
component: "LabeledTextField",
inputType: "text",
zodType: "string().datetime()",
zodType: "string().datetime",
prismaType: "DateTime",
},
uuid: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ describe("Form Generator", () => {
attributeName: "field8",
fieldName: "field8",
field_name: "field8",
zodType: "string().datetime()",
zodType: "string().datetime",
prismaType: "DateTime",
inputType: "text",
},
Expand Down

0 comments on commit 56bd32b

Please sign in to comment.