From 2ec977896313d1283b277ab8ac56816be2e97487 Mon Sep 17 00:00:00 2001 From: "Markus T." <19794318+marcus-wishes@users.noreply.github.com> Date: Tue, 17 Oct 2023 18:32:12 +0200 Subject: [PATCH] DateRangePicker - made onDateRangeSelected optional --- library/src/components/DateRangePicker.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/library/src/components/DateRangePicker.tsx b/library/src/components/DateRangePicker.tsx index 90dfeb04..98e8434b 100644 --- a/library/src/components/DateRangePicker.tsx +++ b/library/src/components/DateRangePicker.tsx @@ -38,7 +38,7 @@ export interface DateRangeProps { disabled?: boolean - onDateRangeSelected: (start: DateType, end: DateType) => void + onDateRangeSelected?: (start: DateType, end: DateType) => void onStartDateSelected?: (dateString: DateType) => void @@ -150,10 +150,12 @@ export function DateRangePicker(props: DateRangeProps) { } } else { setEndDate(pickedDate) - props.onDateRangeSelected( - toDateString(startDate), - toDateString(pickedDate), - ) + if (props.onDateRangeSelected) { + props.onDateRangeSelected( + toDateString(startDate), + toDateString(pickedDate), + ) + } if (props.onEndDateSelected) { props.onEndDateSelected(toDateString(pickedDate)) }