Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Fix #2871: InputNumber duplicating suffix when using decimals" #3727

Merged
merged 1 commit into from
Dec 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions components/lib/inputnumber/InputNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ export const InputNumber = React.memo(

_decimal.current.lastIndex = 0;

return decimalCharIndex !== -1 ? replaceSuffix(val1.split(_decimal.current)[0]) + val2.slice(decimalCharIndex) : val1;
return decimalCharIndex !== -1 ? val1.split(_decimal.current)[0] + val2.slice(decimalCharIndex) : val1;
}

return val1;
Expand All @@ -902,17 +902,13 @@ export const InputNumber = React.memo(
const valueSplit = value.split(_decimal.current);

if (valueSplit.length === 2) {
return replaceSuffix(valueSplit[1]).length;
return valueSplit[1].replace(_suffix.current, '').trim().replace(/\s/g, '').replace(_currency.current, '').length;
}
}

return 0;
};

const replaceSuffix = (value) => {
return value ? value.replace(_suffix.current, '').trim().replace(/\s/g, '').replace(_currency.current, '') : value;
};

const updateModel = (event, value) => {
if (props.onValueChange) {
props.onValueChange({
Expand Down