From a3914ed7576f8ecf03e9623efd07f529c7d6b279 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Mon, 18 Nov 2024 08:06:18 +0530 Subject: [PATCH] update --- lib/validation/rules/maxLength.ts | 5 ++--- lib/validation/rules/maxValue.ts | 5 ++--- lib/validation/rules/minLength.ts | 5 ++--- lib/validation/rules/minValue.ts | 5 ++--- 4 files changed, 8 insertions(+), 12 deletions(-) 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) })