Skip to content

Commit

Permalink
DateRangePicker - made onDateRangeSelected optional
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-wishes committed Oct 17, 2023
1 parent 7636855 commit 2ec9778
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions library/src/components/DateRangePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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))
}
Expand Down

0 comments on commit 2ec9778

Please sign in to comment.