updated
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user