Validate number 18.2 with class-validator

Viewed 2538

I need to validate number 18.2 with class-validator. On current stage I know how to validate only decimal places:

export class PaymentBasicData {
    /**
     * Transaction amount.
     */
    @Expose()
    @IsNotEmpty()
    @IsNumber({ maxDecimalPlaces: 2 })
    @Min(0.01)
    @Max(999999999999999999.99)
    public amount: number;
}

I should validate a number with 18 numbers before dot and 2 numbers after dot. How it should looks like?

0 Answers
Related