mirror of
https://github.com/spliit-app/spliit.git
synced 2026-02-28 10:26:12 +01:00
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>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user