You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The string().date() validation message takes a string as a parameter, date(message?: string): ZodString;
whereas all the rest of the methods take in an errorUtil.ErrMessage, ex: email(message?: errorUtil.ErrMessage): ZodString;
This is not a huge issue, though it is inconsistent with the docs which show error messages for the string().date() validator can be set in this way z.string().date({ message: "Invalid date string!" });
when they actually are set like this z.string().date("Invalid date string!");
The text was updated successfully, but these errors were encountered:
alex-delia
changed the title
Error Message docs inconsistent with actual behaviour for validation methods
Error Message docs inconsistent with actual behaviour for string().date() validation method
Oct 18, 2024
The string().date() validation message takes a string as a parameter,
date(message?: string): ZodString;
whereas all the rest of the methods take in an errorUtil.ErrMessage, ex:
email(message?: errorUtil.ErrMessage): ZodString;
This is not a huge issue, though it is inconsistent with the docs which show error messages for the string().date() validator can be set in this way
z.string().date({ message: "Invalid date string!" });
when they actually are set like this
z.string().date("Invalid date string!");
The text was updated successfully, but these errors were encountered: