From 2a37160a22d4a794bf22c8524489763a6c3c49f9 Mon Sep 17 00:00:00 2001 From: anuraghazra Date: Wed, 22 May 2024 22:07:54 +0530 Subject: [PATCH] chore: set global locale --- packages/blade/src/components/DatePicker/Calendar.web.tsx | 3 +-- packages/blade/src/components/DatePicker/DatePicker.web.tsx | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/blade/src/components/DatePicker/Calendar.web.tsx b/packages/blade/src/components/DatePicker/Calendar.web.tsx index 4c0b5d0bbbb..e666a8fa8da 100644 --- a/packages/blade/src/components/DatePicker/Calendar.web.tsx +++ b/packages/blade/src/components/DatePicker/Calendar.web.tsx @@ -23,7 +23,6 @@ const Calendar = ({ date, defaultDate, onDateChange, - locale, onNext, onPrevious, presets, @@ -129,7 +128,7 @@ const Calendar = ({ withCellSpacing={false} type={isRange ? 'range' : 'default'} date={_date} - locale={locale} + locale={dateContext.locale} level={level} onDateChange={setDate} onLevelChange={(level) => setLevel(() => level)} diff --git a/packages/blade/src/components/DatePicker/DatePicker.web.tsx b/packages/blade/src/components/DatePicker/DatePicker.web.tsx index d0215107910..2d7d850b394 100644 --- a/packages/blade/src/components/DatePicker/DatePicker.web.tsx +++ b/packages/blade/src/components/DatePicker/DatePicker.web.tsx @@ -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'; @@ -217,8 +218,10 @@ const DatePicker = ({ ); const dateProviderValue = React.useMemo(() => { + const locale = convertIntlToDayjsLocale(i18nState?.locale ?? 'en-IN'); + dayjs.locale(locale); return { - locale: convertIntlToDayjsLocale(i18nState?.locale ?? 'en-IN'), + locale, }; }, [i18nState?.locale]);