Description
In a NestJS project, with GraphQL
Decorating a field with @IsDateString does not throw an error if input is "3333".
Will throw error for "6363737398" for instance.
Minimal code-snippet showcasing the problem
@InputType()
export class CreateLessonInput{
// this throws an error when the input is wrong
@MinLength(1)
@Field()
name : string;
// this does not throw an error if startDate is "3333", for instance
@IsDateString({strict : true})
@Field()
startDate : string;
@IsDateString({strict : true})
@Field()
endDate : string;
}
// ----------- ----------
Example of query in Playground:
mutation CreateLesson($creationInput: CreateLessonInput!) {
createLesson(inputForCreation: $creationInput) {
id
name
}
}
where variables are
{"creationInput": {
"name": "History",
"startDate": "3333",
"endDate": "2023-12-28T16:07:06.383Z"
} }
Expected behavior
Validation should return an invalid IsoString as output, since it's not a valid date.
Actual behavior
Error is not thrown
Description
In a NestJS project, with GraphQL
Decorating a field with @IsDateString does not throw an error if input is "3333".
Will throw error for "6363737398" for instance.
Minimal code-snippet showcasing the problem
Expected behavior
Validation should return an invalid IsoString as output, since it's not a valid date.
Actual behavior
Error is not thrown