I have an endpoint that is responsible for bulk inserting some data into my postgres DB
//Bulk insert
@httpPost("/profile/bulk-create",
body()
.customSanitizer(sanitizeToClass(BulkCreateDto))
.custom(validateObject),
checkValidation)
.........
.............
In my dto class i have a field that deals with a date value
export class CreateAccountProfileDto{
.....
.......
@Expose()
@IsDateString()
@IsOptional()
OpenDate: Date
.......
.......
}
The date value received is in the following format 2021/04/19 and every time i try to bulk insert into DB, the following error shows up
OpenDate must be a valid ISO 8601 date string
Does the @IsDateString class-validator not work with the above date format?
@IsISO8601()Feast your eyes: github.com/typestack/class-validator