Passing config prop to zod schema for dynamic refinement

Please correct me if i am approaching this from the wrong perspective, im building a form with a calendar component, users should be able to select from and to dates, after submitting i want zod to validate if it is withing the range of minDays and maxDays. These two values would be provided by data fetched from a server, how would i pass it into my zod schema? Many thanks!
2 Replies
Spark
Spark7mo ago
React Hook Form
Building forms with React Hook Form and Zod.
tachito - pablokitz
Im currently using exactly that library, however i am struggling with the form validation, i have some parts that depend on a configuration JSON, not entirely shure how to handle it :/