Skip to content
Open
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
10 changes: 8 additions & 2 deletions src/InputNumber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,11 @@ class InputNumber extends React.Component<Partial<InputNumberProps>, InputNumber
let value = e.target.value.trim().replace(/。/g, '.');

if (isValidProps(this.props.decimalSeparator)) {
value = value.replace(this.props.decimalSeparator, '.');
// https://github.com/ant-design/ant-design/issues/28057
// replace last separator
// value = value.replace(this.props.decimalSeparator, '.');
const regExp = new RegExp(`(.*)${this.props.decimalSeparator}`);
value = value.replace(regExp, '$1.');
}

return value;
Expand Down Expand Up @@ -452,7 +456,9 @@ class InputNumber extends React.Component<Partial<InputNumberProps>, InputNumber
if (isValidProps(this.props.decimalSeparator)) {
inputDisplayValueFormat = inputDisplayValueFormat
.toString()
.replace('.', this.props.decimalSeparator);
.replace(/(.*)\./, `$1${this.props.decimalSeparator}`);
// fixed https://github.com/ant-design/ant-design/issues/28057
// .replace('.', this.props.decimalSeparator);
}

return inputDisplayValueFormat;
Expand Down