remix-params-helper icon indicating copy to clipboard operation
remix-params-helper copied to clipboard

Support for parsing `type=date` from `z.string().pipe(z.coerce.date())`

Open solomonhawk opened this issue 1 year ago • 0 comments

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.

solomonhawk avatar May 02 '23 14:05 solomonhawk