Skip to content

Commit

Permalink
geosolutions-it#10663: fix adding decimals in the aeronautical form
Browse files Browse the repository at this point in the history
Description:
- add helpful comment
  • Loading branch information
mahmoudadel54 committed Nov 12, 2024
1 parent 1008018 commit 58e7e6c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion web/client/libs/numeric-input/NumericInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ class NumericInput extends Component {
);

let loose = !this._isStrict && (this._inputFocus || !this._isMounted);
// create regex for numbers that contains centesimal decimal numbers
const numFormat = new Intl.NumberFormat(this.props.locale || "en-US");
const parts = numFormat.formatToParts(12345.6);
const decimalSymbol = parts.find(d => d.type === "decimal").value;
Expand All @@ -416,7 +417,7 @@ class NumericInput extends Component {
// incomplete number
if (loose && RE_INCOMPLETE_NUMBER.test(stringValue)) {
attrs.input.value = stringValue;
} else if ((loose && stringValue && !RE_NUMBER.test(stringValue)) || RE_TRAILING_DECIMAL_ZEROS.test(stringValue)) {// Not a number and not empty (loose mode only)
} else if ((loose && stringValue && !RE_NUMBER.test(stringValue)) || RE_TRAILING_DECIMAL_ZEROS.test(stringValue)) {// Not a number and not empty (loose mode only) || if number contains decimal symbol [centesimal decimal numbers]
attrs.input.value = stringValue;
} else if (state.value || state.value === 0) { // number
attrs.input.value = this._format(state.value);
Expand Down

0 comments on commit 58e7e6c

Please sign in to comment.