Skip to content

Commit

Permalink
chore: set global locale
Browse files Browse the repository at this point in the history
  • Loading branch information
anuraghazra committed May 22, 2024
1 parent e02fba6 commit 2a37160
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 1 addition & 2 deletions packages/blade/src/components/DatePicker/Calendar.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const Calendar = <Type extends DateSelectionType>({
date,
defaultDate,
onDateChange,
locale,
onNext,
onPrevious,
presets,
Expand Down Expand Up @@ -129,7 +128,7 @@ const Calendar = <Type extends DateSelectionType>({
withCellSpacing={false}
type={isRange ? 'range' : 'default'}
date={_date}
locale={locale}
locale={dateContext.locale}
level={level}
onDateChange={setDate}
onLevelChange={(level) => setLevel(() => level)}
Expand Down
5 changes: 4 additions & 1 deletion packages/blade/src/components/DatePicker/DatePicker.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import React from 'react';
import { FloatingFocusManager, FloatingPortal } from '@floating-ui/react';
import { useI18nContext } from '@razorpay/i18nify-react';
import { HeadlessMantineProvider } from '@mantine/core';
import dayjs from 'dayjs';
import type { DatesRangeValue, DatePickerProps, DateSelectionType, PickerType } from './types';
import { Calendar } from './Calendar';
import { PresetSideBar } from './QuickSelection/PresetSideBar';
Expand Down Expand Up @@ -217,8 +218,10 @@ const DatePicker = <Type extends DateSelectionType = 'single'>({
);

const dateProviderValue = React.useMemo(() => {
const locale = convertIntlToDayjsLocale(i18nState?.locale ?? 'en-IN');
dayjs.locale(locale);
return {
locale: convertIntlToDayjsLocale(i18nState?.locale ?? 'en-IN'),
locale,
};
}, [i18nState?.locale]);

Expand Down

0 comments on commit 2a37160

Please sign in to comment.