Skip to content

Commit 94358d2

Browse files
authored
fix(useDatePicker): fix onDateSelect type, export types (#79)
* fix(useDatePicker): fix onDateSelect type, export types * fix: remove calendarDate from OnDateSelectPayload * style: run prettier
1 parent a552534 commit 94358d2

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/hooks/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
export { useResolvedDirection } from './useResolvedDirection'
2-
export { useDatePicker } from './useDatePicker'
2+
export {
3+
useDatePicker,
4+
DatePickerOptions,
5+
OnDateSelectPayload,
6+
} from './useDatePicker'

src/hooks/useDatePicker.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ import {
1717
import { useResolvedLocaleOptions } from './internal/useResolvedLocaleOptions'
1818
import { useWeekDayLabels } from './internal/useWeekDayLabels'
1919

20-
type DatePickerOptions = {
20+
export type OnDateSelectPayload = {
21+
calendarDateString: string
22+
} | null
23+
24+
export type DatePickerOptions = {
2125
date: string
2226
options: PickerOptions
23-
onDateSelect: ({
24-
calendarDateString,
25-
}: {
26-
calendarDateString: string
27-
}) => void
27+
onDateSelect: (payload: OnDateSelectPayload) => void
2828
minDate?: string
2929
maxDate?: string
3030
format?: 'YYYY-MM-DD' | 'DD-MM-YYYY'

0 commit comments

Comments
 (0)