#Phone number validation not working as expected
6 messages · Page 1 of 1 (latest)
I think you have to set what country code is expected, cause otherwise it defaults to USA format (iirc)
same issue when I update the DTO to:
import { ApiProperty } from '@nestjs/swagger';
import { IsPhoneNumber } from 'class-validator';
export class AddTeamMemberDto {
@IsPhoneNumber('IN')
@ApiProperty()
primaryPhoneNumber: string;
}
I am using multipart form btw
however, a JSON payload works
I think using this might be useful: https://github.com/dmitriy-nz/nestjs-form-data
GitHub
NestJS middleware for handling multipart/form-data, which is primarily used for uploading files. - dmitriy-nz/nestjs-form-data