Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Message docs inconsistent with actual behaviour for string().date() validation method #3808

Open
alex-delia opened this issue Oct 18, 2024 · 0 comments

Comments

@alex-delia
Copy link

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!");

@alex-delia 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant