Skip to content

Commit

Permalink
fix(time-picker): error
Browse files Browse the repository at this point in the history
  • Loading branch information
chen_gh committed Sep 9, 2024
1 parent a265659 commit 3c0d8a2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/static-past-time-picker/StaticPastTimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,13 @@ function StaticPastTimePicker({
],
[experimental, localLocale]
);
const options = useMemo(() => quickOptions || localQuickOptions, [quickOptions, localQuickOptions]);

earliestApprove && options.push({ value: 'earliest', label: localLocale.earliestInHistory });
const options = useMemo(
() => [
...(quickOptions || localQuickOptions),
...(earliestApprove ? [{ value: 'earliest', label: localLocale.earliestInHistory }] : []),
],
[quickOptions, localQuickOptions, earliestApprove, localLocale]
);

const parseMode = useCallback((current: string | undefined) => parseTimeMode(current, options), [options]);
const originMode = (parseMode(timeRange) ?? TimeMode.Quick) as TimeMode;
Expand Down

0 comments on commit 3c0d8a2

Please sign in to comment.