This commit is contained in:
2024-08-14 12:19:27 +05:30
parent 83aa170c60
commit 2d641a9748
13 changed files with 215 additions and 190 deletions

View File

@@ -13,15 +13,15 @@ const CurrencyInput = forwardRef(({ value, onChange, ...props }, ref) => {
const handleChange = (event) => {
let { value } = event.target;
let { value } = event?.target;
// Remove non-numeric characters except decimal point
value = value.replace(/[^0-9.]/g, '');
value = value?.replace(/[^0-9.]/g, '');
// Ensure only one decimal point
const parts = value.split('.');
const parts = value?.split('.');
if (parts.length > 2) {
value = parts[0] + '.' + parts.slice(1).join('');
value = parts[0] + '.' + parts?.slice(1)?.join('');
}
onChange(value); // Pass the raw value to parent or use it directly