Skip to content

Commit

Permalink
fix(input,input-number): allow typing decimal separator in firefox fo…
Browse files Browse the repository at this point in the history
…r arabic locale (#7173)

**Related Issue:** #7130 

## Summary

This PR will allow users to type `latn` decimal separator for `arabic`
lang in Firefox & safari for `calcite-input` and `calcite-input-number`.
  • Loading branch information
anveshmekala authored Jun 14, 2023
1 parent d8113b9 commit 595e6f2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/calcite-components/src/utils/locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,11 @@ export class NumberStringFormat {
].reverse();

const index = new Map(this._digits.map((d, i) => [d, i]));
const parts = new Intl.NumberFormat(this._numberFormatOptions.locale).formatToParts(-12345678.9);

// numberingSystem is parsed to return consistent decimal separator across browsers.
const parts = new Intl.NumberFormat(this._numberFormatOptions.locale, {
numberingSystem: this._numberFormatOptions.numberingSystem
} as Intl.NumberFormatOptions).formatToParts(-12345678.9);

this._actualGroup = parts.find((d) => d.type === "group").value;
// change whitespace group characters that don't render correctly
Expand Down

0 comments on commit 595e6f2

Please sign in to comment.