Skip to content

Commit

Permalink
docs: fix Account form example (#1256)
Browse files Browse the repository at this point in the history
  • Loading branch information
huntabyte authored Aug 28, 2024
1 parent 2e6474a commit e49d1dd
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
language: z.enum(languages.map((lang) => lang.value) as [Language, ...Language[]]),
dob: z
.string()
.datetime()
.datetime({ message: "" })
// we're setting it optional so the user can clear the date and we don't run into
// type issues, but we refine it to make sure it's not undefined
.optional()
.refine((date) => date !== undefined, "Please select a valid date."),
.refine((date) => date !== "", "Please select a valid date."),
});
export type AccountFormSchema = typeof accountFormSchema;
Expand Down Expand Up @@ -108,7 +108,7 @@
}}
onValueChange={(value) => {
if (value === undefined) {
$formData.dob = undefined;
$formData.dob = "";
validate("dob");
return;
}
Expand Down

0 comments on commit e49d1dd

Please sign in to comment.