-
-
Notifications
You must be signed in to change notification settings - Fork 765
Description
I'm trying out the DayPickerInput component in TypeScript, but I can't access the modifiers in the onDayChange event. Are the TypeScript typings wrong? Or am I missing something?
From the docs:
http://react-day-picker.js.org/api/DayPickerInput
onDayChange (day: Date, modifiers: Object) ⇒ void
Handler function called when the user types a valid day (according to the format prop) or when a day is clicked on the calendar. If the day is not valid, day and modifiers arguments will be undefined (useful to display validation warnings).
From /types/props.d.ts:
onDayChange?(e: React.FocusEvent<HTMLDivElement>): void;
Should this be instead:
onDayChange?(day: Date | undefined, modifiers: {} | undefined): void;
?
Is there a type for Modifiers btw?
If I try to do this:
<DayPickerInput onDayChange={this.handleDayChange} />
this works:
handleDayChange = (e: any) => { console.log('this works, e is date, not focusevent');}
this should work (?), but does not..:
handleDayChange = (day: Date, modifiers: {} | undefined) => { console.log('error');}