diff options
| author | Jan T <jans.tuomi@gmail.com> | 2024-02-28 17:57:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-28 10:57:55 -0500 |
| commit | 4c5f8a6aa55f52e70f3181b06967e5351695c731 (patch) | |
| tree | db2c927a2730febb3c340ce66fe9cc6eb2aa8b9e /src/lib/schemas.ts | |
| parent | c2b591349b27700f9a703e9b2db1ea0afeac0497 (diff) | |
Fix decimal separator issue in numeric form fields (#115)
* Revert 5b65b8f, fix comma issue with type="text" and onChange
* Fix comma issue in "paid for" input
* Run prettier autoformat
* Allow only digits and dots in currency inputs
* Fix behaviour in paidFor field
* Fix duplicated onChange prop
---------
Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
Diffstat (limited to 'src/lib/schemas.ts')
| -rw-r--r-- | src/lib/schemas.ts | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/lib/schemas.ts b/src/lib/schemas.ts index d68adf4..52b0d0d 100644 --- a/src/lib/schemas.ts +++ b/src/lib/schemas.ts @@ -51,8 +51,7 @@ export const expenseFormSchema = z [ z.number(), z.string().transform((value, ctx) => { - const normalizedValue = value.replace(/,/g, '.') - const valueAsNumber = Number(normalizedValue) + const valueAsNumber = Number(value) if (Number.isNaN(valueAsNumber)) ctx.addIssue({ code: z.ZodIssueCode.custom, |
