remix-params-helper
remix-params-helper copied to clipboard
Support for parsing `type=date` from `z.string().pipe(z.coerce.date())`
In my schema I use z.string().pipe(z.coerce.date()).transform((date) => toServerDate(date))
for a date field. I want to validate that it's a string containing a valid date (and then output it in a particular format).
This isn't picked up as type=date
because it isn't an instanceof ZodDate
, instead it involves some nesting of ZodEffects
, ZodPipeline
and potentially ZodOptional
(handled).
It looks like the handling in processDef
covers more cases than getInputProps
but isn't used in the useFormInputProps(..)
workflow.
I will put up a PR shortly that suggests a possible change.