You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
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');}
The text was updated successfully, but these errors were encountered:
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
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');}
The text was updated successfully, but these errors were encountered: