Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

Commit

Permalink
only onChange on Apply for range mode
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperkristensen committed Oct 6, 2023
1 parent 6b4b93b commit 832edd4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/ui/src/components/date-picker/date-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,6 @@ const RangeDatePicker = ({
}

setRange(newRange)
onChange?.(newRange)
}

const onCancel = () => {
Expand Down Expand Up @@ -641,6 +640,11 @@ const RangeDatePicker = ({
}`
}, [range, showTimePicker])

const onApply = () => {
setOpen(false)
onChange?.(range)
}

return (
<Primitives.Root open={open} onOpenChange={onOpenChange}>
<Display
Expand Down Expand Up @@ -717,11 +721,7 @@ const RangeDatePicker = ({
<Button variant="secondary" type="button" onClick={onCancel}>
Cancel
</Button>
<Button
variant="primary"
type="button"
onClick={() => setOpen(false)}
>
<Button variant="primary" type="button" onClick={onApply}>
Apply
</Button>
</div>
Expand Down

0 comments on commit 832edd4

Please sign in to comment.