Skip to content

Commit

Permalink
Stats: Fix applying the custom range shortcut without dates (#97102)
Browse files Browse the repository at this point in the history
  • Loading branch information
dognose24 authored Dec 5, 2024
1 parent 3145f3e commit c7302c1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions client/components/date-range/shortcuts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const DateRangePickerShortcuts = ( {
isNewDateFilteringEnabled = false,
}: {
currentShortcut?: string;
onClick: ( newFromDate: moment.Moment, newToDate: moment.Moment, shortcutId: string ) => void;
onClick: ( newFromDate: moment.Moment, newToDate: moment.Moment ) => void;
onShortcutClick?: ( shortcut: DateRangePickerShortcut ) => void;
locked?: boolean;
startDate?: MomentOrNull;
Expand Down Expand Up @@ -59,7 +59,9 @@ const DateRangePickerShortcuts = ( {

const handleClick = ( shortcut: DateRangePickerShortcut ) => {
! locked &&
onClick( moment( shortcut.startDate ), moment( shortcut.endDate ), shortcut.id || '' );
shortcut.startDate &&
shortcut.endDate &&
onClick( moment( shortcut.startDate ), moment( shortcut.endDate ) );

// Call the onShortcutClick if provided
onShortcutClick && onShortcutClick( shortcut );
Expand Down

0 comments on commit c7302c1

Please sign in to comment.