New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add `onTodayButtonClick` event handler #529

Closed
gpbl opened this Issue Oct 26, 2017 · 0 comments

Comments

1 participant
@gpbl
Owner

gpbl commented Oct 26, 2017

This event handle should be called when the todayButton prop is set and the today button is clicked. See #528.

onTodayButtonClick signature:
(day: Date, modifiers: Object, e: SyntheticEvent) ⇒ undefined

Usage example

class MyComponent extends Component {
  constructor(props) {
    super(props);
    this.handleTodayButtonClick = this.handleTodayButtonClick.bind(this);
    this.state = {
      selectedDay: undefined,
    };
  }
  handleTodayButtonClick(day, modifiers, e) {
    this.setState({ selectedDay: day });
  }
  render() {
    return (
      <div>
        <DayPicker
          todayButton="Go to Today"
          onTodayButtonClick={this.handleTodayButtonClick}
        />
      </div>
    );
  }
}

Checklist

  • Add onTodayButtonClick prop (default is undefined)
  • Add unit test
  • Update API docs
  • Update today button example

@gpbl gpbl added the new feature label Oct 26, 2017

@gpbl gpbl added this to the v6.3.0 milestone Oct 26, 2017

@gpbl gpbl self-assigned this Oct 26, 2017

@gpbl gpbl closed this in #550 Nov 15, 2017

@gpbl gpbl modified the milestones: v6.3.0, v7.0.0 Nov 25, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment