Skip to content

Commit 3e1ed2d

Browse files
authored
fix(input-date-picker): apply default numbering system to avoid browser inferring from locale (#7682)
**Related Issue:** #7529 ## Summary This applies our default numbering system to `input-date-picker`'s date formatting. ### Notes * Existing screenshot tests cover these changes. * Firefox and Safari will now use `latn` as the default numbering system when formatting the selected date when not explicitly specified.
1 parent 59f1c31 commit 3e1ed2d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/calcite-components/src/components/input-date-picker/input-date-picker.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import {
5858
} from "../../utils/loadable";
5959
import {
6060
connectLocalized,
61+
defaultNumberingSystem,
6162
disconnectLocalized,
6263
LocalizedComponent,
6364
NumberingSystem,
@@ -1002,10 +1003,17 @@ export class InputDatePicker
10021003
)
10031004
: null;
10041005

1006+
const formattingOptions = {
1007+
// we explicitly set numberingSystem to prevent the browser-inferred value
1008+
// see https://github.com/Esri/calcite-design-system/issues/3079#issuecomment-1168964195 for more info
1009+
numberingSystem: defaultNumberingSystem,
1010+
};
1011+
10051012
const localizedDate =
1006-
date && this.formatNumerals(date.toLocaleDateString(this.effectiveLocale));
1013+
date && this.formatNumerals(date.toLocaleDateString(this.effectiveLocale, formattingOptions));
10071014
const localizedEndDate =
1008-
endDate && this.formatNumerals(endDate.toLocaleDateString(this.effectiveLocale));
1015+
endDate &&
1016+
this.formatNumerals(endDate.toLocaleDateString(this.effectiveLocale, formattingOptions));
10091017

10101018
this.setInputValue(localizedDate ?? "", "start");
10111019
this.setInputValue((this.range && localizedEndDate) ?? "", "end");

0 commit comments

Comments
 (0)