Skip to content

Commit

Permalink
Minor refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
atomiks committed Apr 11, 2024
1 parent 4e180da commit 091837a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions packages/mui-base/src/NumberField/utils/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,10 @@ export function getNumberLocaleDetails(
}

export function parseNumber(formattedNumber: string, options?: Intl.NumberFormatOptions) {
const isArabic = formattedNumber.match(ARABIC_RE);
const isHan = formattedNumber.match(HAN_RE);

let locale: string | undefined;
if (isArabic) {
if (ARABIC_RE.test(formattedNumber)) {
locale = 'ar';
} else if (isHan) {
} else if (HAN_RE.test(formattedNumber)) {
locale = 'zh';
}

Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/NumberField/utils/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getFormatter } from './format';

export function removeFloatingPointErrors(value: number, format: Intl.NumberFormatOptions = {}) {
return parseFloat(
getFormatter(undefined, {
getFormatter('en-US', {
maximumFractionDigits: format.maximumFractionDigits,
minimumFractionDigits: format.minimumFractionDigits,
useGrouping: false,
Expand Down

0 comments on commit 091837a

Please sign in to comment.