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

fix: passing options when using @IsDateString() #1097

Closed
wants to merge 73 commits into from

Conversation

hakimio
Copy link
Contributor

@hakimio hakimio commented May 26, 2021

Description

@IsDateString({strict: true}) doesn't work because options are not passed to the validator.

Fixes

Fixes #1061

dependabot bot added 30 commits March 23, 2021 17:40
dependabot bot and others added 19 commits May 10, 2021 12:25
`@IsDateString({strict: true})` doesn't work because options are not passed to the validator.

Fixes typestack#1061
@@ -24,7 +24,7 @@ export function IsDateString(
name: IS_DATE_STRING,
constraints: [options],
validator: {
validate: (value, args): boolean => isDateString(value),
validate: (value, args): boolean => isDateString(value, args.constraints[0]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should work and reads better, no?

Suggested change
validate: (value, args): boolean => isDateString(value, args.constraints[0]),
validate: (value, args): boolean => isDateString(value, options),

@braaar
Copy link
Member

braaar commented Aug 16, 2022

Would you care to rebase/merge this to get rid of merge conflicts and irrelevant changes?

@hakimio hakimio closed this Aug 16, 2022
@GCastilho
Copy link

Any reason any it was closed?

@braaar
Copy link
Member

braaar commented Aug 17, 2022

I would assume @hakimio is going to make a fresh PR instead of fixing this one. It's a bit cleaner that way, and it makes it easier to pass the unnecessarily strict commit message check

@hakimio
Copy link
Contributor Author

hakimio commented Aug 17, 2022

PR #1720

@hakimio hakimio deleted the patch-1 branch August 17, 2022 07:29
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

fix: option is not passed to validator in @IsDateString decorator
3 participants