Skip to content

Commit

Permalink
fix: correct the origin on "maximumFractionDigits" when deciding "inp…
Browse files Browse the repository at this point in the history
…utMode"
  • Loading branch information
Westbrook authored and najikahalsema committed Nov 1, 2022
1 parent fe9d430 commit e2fe9c8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/number-field/src/NumberField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ export class NumberField extends TextfieldBase {
}

private convertValueToNumber(value: string): number {
if (isIPhone() && this.inputElement.inputMode === 'decimal') {
value = value.replace(',', '.');
}
return this.numberParser.parse(value);
}

Expand Down Expand Up @@ -590,9 +593,9 @@ export class NumberField extends TextfieldBase {
if (changes.has('min') || changes.has('formatOptions')) {
let inputMode = 'numeric';
const hasNegative = typeof this.min !== 'undefined' && this.min < 0;
const { maximumFractionDigits } = this.formatOptions;
const hasDecimals =
maximumFractionDigits && maximumFractionDigits > 0;
const { maximumFractionDigits } =
this.numberFormatter.resolvedOptions();
const hasDecimals = maximumFractionDigits > 0;
/* c8 ignore next 18 */
if (isIPhone()) {
// iPhone doesn't have a minus sign in either numeric or decimal.
Expand Down

0 comments on commit e2fe9c8

Please sign in to comment.