Skip to content

Commit

Permalink
update Date object to String
Browse files Browse the repository at this point in the history
  • Loading branch information
John-Paul-Larkin committed Aug 13, 2024
1 parent 4fa4321 commit 316aa25
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/(app)/alpha/additional-details/_actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export async function handleFormSlideTwoSubmit(dataInput: TypeSlideTwoSchema) {
await db
.update(user)
.set({
dateOfBirth: dateOfBirth.toISOString(),
dateOfBirth,
gender,
})
.where(eq(user.id, session.user.id));
Expand Down
4 changes: 2 additions & 2 deletions app/(app)/alpha/additional-details/_client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type UserDetails = {
firstName: string;
surname: string;
gender: string;
dateOfBirth: Date | undefined;
dateOfBirth: string;
location: string;
professionalOrStudent: string;
course: string;
Expand Down Expand Up @@ -274,7 +274,7 @@ function SlideTwo({ details }: { details: UserDetails }) {
} else {
selectedDate = new Date(year, month, day);
}
setValue("dateOfBirth", selectedDate);
setValue("dateOfBirth", selectedDate.toISOString());
}
}, [year, month, day]);

Expand Down
2 changes: 1 addition & 1 deletion app/(app)/alpha/additional-details/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default async function Page() {
firstName: details?.firstName || "",
surname: details?.surname || "",
gender: details?.gender || "",
dateOfBirth: details?.dateOfBirth || undefined,
dateOfBirth: details?.dateOfBirth || "",
location: details?.location || "",
professionalOrStudent: details?.professionalOrStudent || "",
course: details?.course || "",
Expand Down
2 changes: 1 addition & 1 deletion schema/additionalUserDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const slideOneSchema = z.object({

export const slideTwoSchema = z.object({
gender: z.string().min(1, "Gender is required"),
dateOfBirth: z.date(),
dateOfBirth: z.string(),
});

export const slideThreeSchema = z
Expand Down

0 comments on commit 316aa25

Please sign in to comment.