From 87bd14e6b75ea56cc4bc68ebeb32b26d6aa66a52 Mon Sep 17 00:00:00 2001 From: tewarig Date: Wed, 15 Jan 2025 12:59:33 +0530 Subject: [PATCH] chore: update date formats --- packages/blade/src/components/DatePicker/DatePicker.web.tsx | 5 +---- packages/blade/src/components/DatePicker/types.ts | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/blade/src/components/DatePicker/DatePicker.web.tsx b/packages/blade/src/components/DatePicker/DatePicker.web.tsx index 8ad481193c5..4b5d7559497 100644 --- a/packages/blade/src/components/DatePicker/DatePicker.web.tsx +++ b/packages/blade/src/components/DatePicker/DatePicker.web.tsx @@ -66,7 +66,7 @@ const DatePicker = ({ picker, onPickerChange, zIndex = componentZIndices.popover, - format, + format = 'DD/MM/YYYY', inputPlaceHolder, ...props }: DatePickerProps & StyledPropsBlade & DataAnalyticsAttribute): React.ReactElement => { @@ -89,9 +89,6 @@ const DatePicker = ({ if (format) { return format; } - if (picker === 'day') { - return 'DD'; - } if (picker === 'month') { return 'MMMM'; } diff --git a/packages/blade/src/components/DatePicker/types.ts b/packages/blade/src/components/DatePicker/types.ts index 3644900c3de..94b12f5a0f4 100644 --- a/packages/blade/src/components/DatePicker/types.ts +++ b/packages/blade/src/components/DatePicker/types.ts @@ -166,7 +166,7 @@ type DatePickerProps = Omit< * Sets the date format to be displayed in the input field. * @default 'DD/MM/YYYY' if pickerType is 'date' then 'DD', if pickerType is 'month' then 'MMMM', 'YYYY' if pickerType is 'year' */ - format?: string; + format?: 'DD/MM/YYYY' | 'MMM' | 'MMMM' | 'YYYY'; /** * Placeholder text for the datepicker input , when no date is selected. * @default 'DD/MM/YYYY' if pickerType is 'date' then 'DD', if pickerType is 'month' then 'MMMM', 'YYYY' if pickerType is 'year'