From 589b4b6a7c133cb74c4d11689ba30ec9d6d8edaa Mon Sep 17 00:00:00 2001 From: Sergey Kazarinov Date: Wed, 4 Dec 2024 00:23:44 +0500 Subject: [PATCH] fix: types for startDate and endDate props (#5259) --- src/day.tsx | 4 ++-- src/index.tsx | 3 ++- src/month.tsx | 2 ++ src/year.tsx | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/day.tsx b/src/day.tsx index ecb40ce4c..833aa43af 100644 --- a/src/day.tsx +++ b/src/day.tsx @@ -39,7 +39,6 @@ interface DayProps disabledKeyboardNavigation?: boolean; day: Date; dayClassName?: (date: Date) => string; - endDate?: Date; highlightDates?: Map; holidays?: HolidaysMap; inline?: boolean; @@ -60,7 +59,8 @@ interface DayProps selectsDisabledDaysInRange?: boolean; selectsMultiple?: boolean; selectedDates?: Date[]; - startDate?: Date; + startDate?: Date | null; + endDate?: Date | null; renderDayContents?: (day: number, date: Date) => React.ReactNode; containerRef?: React.RefObject; calendarStartDay?: DateNumberType; diff --git a/src/index.tsx b/src/index.tsx index 1b4186971..9277d9f2d 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -176,7 +176,8 @@ export type DatePickerProps = OmitUnion< calendarIconClassName?: string; toggleCalendarOnIconClick?: boolean; holidays?: Holiday[]; - startDate?: Date; + startDate?: Date | null; + endDate?: Date | null; selected?: Date | null; value?: string; customInputRef?: string; diff --git a/src/month.tsx b/src/month.tsx index 41498ea85..5140d9a15 100644 --- a/src/month.tsx +++ b/src/month.tsx @@ -124,6 +124,8 @@ interface MonthProps handleOnMonthKeyDown?: (event: React.KeyboardEvent) => void; ariaLabelPrefix?: string; day: Date; + startDate?: Date | null; + endDate?: Date | null; orderInDisplay?: number; fixedHeight?: boolean; peekNextMonth?: boolean; diff --git a/src/year.tsx b/src/year.tsx index b96e67087..a32c3e7df 100644 --- a/src/year.tsx +++ b/src/year.tsx @@ -30,7 +30,6 @@ interface YearProps clearSelectingDate?: VoidFunction; date?: Date; disabledKeyboardNavigation?: boolean; - endDate?: Date; onDayClick?: ( date: Date, event: @@ -55,7 +54,8 @@ interface YearProps selectsEnd?: boolean; selectsStart?: boolean; selectsRange?: boolean; - startDate?: Date; + startDate?: Date | null; + endDate?: Date | null; yearItemNumber?: number; handleOnKeyDown?: React.KeyboardEventHandler; yearClassName?: (date: Date) => string;