Skip to content
Discussion options

You must be logged in to vote

I've tried here to pick out the bare minimum of what I ended up doing to make this all work.

Hopefully this can help someone else.

I've left out error handling and imports.

If anyone has suggestions for improvements, please let me know...

Prisma/data model

# schema.prisma

model Account {
  userId String @id
  dateOfBirth: DateTime
}
// model.ts

type Account = {
  userId: string
  dateOfBirth: Date
}

Zod validation schema

// account-schema.ts

export const accountSchema = z.object({
    dateOfBirth: z.coerce.date() // will invoke new Date(isoStringFromFormData)
})

export type AccountSchema = z.infer<typeof accountSchema>

Remix route

// app/routes/my-account.tsx

export const loader = a…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by caprica
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants