Skip to content

fix: tighten amount input validation - #468

Open
omerbek wants to merge 1 commit into
circlefin:masterfrom
omerbek:fix/amount-input-validation
Open

omerbek wants to merge 1 commit into
circlefin:masterfrom
omerbek:fix/amount-input-validation

Conversation

@omerbek

@omerbek omerbek commented Aug 13, 2026

Copy link
Copy Markdown

Summary

Fixes #467.

  • Move the shared amount validation rules into a small testable helper.
  • Require the whole amount string to match a decimal currency format with an escaped decimal point.
  • Reject malformed values such as 12a34, 12,34, and 1.2.3 instead of accepting them through partial parseInt / parseFloat parsing.
  • Keep valid values like 12, 12.3, and 12.34 accepted, while still rejecting zero as non-positive.

Testing

corepack yarn install --frozen-lockfile
# failed locally because this host is Node 21.6.1 and nuxt@3.18.1 requires ^20.19.0 || >=22.12.0

corepack yarn install --frozen-lockfile --ignore-engines
# passed; nuxt prepare completed

corepack yarn test components/amountValidation.test.ts --runInBand
# passed, 7 tests

corepack yarn eslint components/AmountInput.vue components/amountValidation.ts components/amountValidation.test.ts
# passed

git diff --check
# passed

Full corepack yarn lint on this Windows checkout still fails on existing repository-wide CRLF/Prettier findings unrelated to this patch, so I also ran scoped eslint on the touched files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AmountInput accepts malformed currency strings

1 participant