class-validator icon indicating copy to clipboard operation
class-validator copied to clipboard

IsDate behaviour

Open andreanta opened this issue 8 years ago • 3 comments

Hello, I have sent the following date as part of a JSON object:

 "DataIscrizione": "2010-10-10T00:00:00.000Z",

The desciption of the property is the following:

@ApiModelProperty()
// @IsDate({ message: "La data deve essere valida" })
@Column({ nullable: true })
DataIscrizione: Date;

if i set the IsDate the validation is wrong.

If i remove the date is being persisted to DB.

I'm using mySql, and NestJs

andreanta avatar Nov 01 '18 15:11 andreanta

use IsDateString

MichalLytek avatar Nov 01 '18 16:11 MichalLytek

Hi @andreanta!

It's not clear for me what is your exact problem, but probably @19majkel94 is right, if you want to verify that the received property is a valid date string then you need to use the @IsDateString decorator.

I will go ahead and close this question. Feel free to continue the discussion if we haven't answered your problem.

NoNameProvided avatar Nov 04 '18 21:11 NoNameProvided

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

lock[bot] avatar Nov 11 '18 21:11 lock[bot]