diff --git a/lib/validation/rules/maxLength.ts b/lib/validation/rules/maxLength.ts index 567b905a..89ebaf73 100644 --- a/lib/validation/rules/maxLength.ts +++ b/lib/validation/rules/maxLength.ts @@ -1,3 +1,4 @@ +import { format } from '../../support/Num' import { createRule } from '../Rule' import { maxLength as baseMaxLength } from '../validators' @@ -7,10 +8,8 @@ export const message = { } export function maxLength(length: number, msg?: string) { - const formatted = Intl.NumberFormat().format(length) - return createRule({ - message: ({ lang }) => msg ?? message[lang](formatted), + message: ({ lang }) => msg ?? message[lang](format(length)), optional: true, validation: (value) => baseMaxLength(value, length) }) diff --git a/lib/validation/rules/maxValue.ts b/lib/validation/rules/maxValue.ts index ed7211fb..fb2c9b0f 100644 --- a/lib/validation/rules/maxValue.ts +++ b/lib/validation/rules/maxValue.ts @@ -1,3 +1,4 @@ +import { format } from '../../support/Num' import { createRule } from '../Rule' import { maxValue as baseMaxValue } from '../validators' @@ -7,10 +8,8 @@ export const message = { } export function maxValue(max: number, msg?: string) { - const formatted = Intl.NumberFormat().format(max) - return createRule({ - message: ({ lang }) => msg ?? message[lang](formatted), + message: ({ lang }) => msg ?? message[lang](format(max)), optional: true, validation: (value) => baseMaxValue(value, max) }) diff --git a/lib/validation/rules/minLength.ts b/lib/validation/rules/minLength.ts index f429bd09..3ee13bb6 100644 --- a/lib/validation/rules/minLength.ts +++ b/lib/validation/rules/minLength.ts @@ -1,3 +1,4 @@ +import { format } from '../../support/Num' import { createRule } from '../Rule' import { minLength as baseMinLength } from '../validators' @@ -7,10 +8,8 @@ export const message = { } export function minLength(length: number, msg?: string) { - const formatted = Intl.NumberFormat().format(length) - return createRule({ - message: ({ lang }) => msg ?? message[lang](formatted), + message: ({ lang }) => msg ?? message[lang](format(length)), optional: true, validation: (value) => baseMinLength(value, length) }) diff --git a/lib/validation/rules/minValue.ts b/lib/validation/rules/minValue.ts index 28e56e43..66c63e01 100644 --- a/lib/validation/rules/minValue.ts +++ b/lib/validation/rules/minValue.ts @@ -1,3 +1,4 @@ +import { format } from '../../support/Num' import { createRule } from '../Rule' import { minValue as baseMinValue } from '../validators' @@ -7,10 +8,8 @@ export const message = { } export function minValue(min: number, msg?: string) { - const formatted = Intl.NumberFormat().format(min) - return createRule({ - message: ({ lang }) => msg ?? message[lang](formatted), + message: ({ lang }) => msg ?? message[lang](format(min)), optional: true, validation: (value) => baseMinValue(value, min) })