Skip to content
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

not updating hour & minute when changing them #78

Closed
msman opened this issue Mar 27, 2018 · 2 comments
Closed

not updating hour & minute when changing them #78

msman opened this issue Mar 27, 2018 · 2 comments

Comments

@msman
Copy link

msman commented Mar 27, 2018

hi

the demo worked, but when I click on hour and minute to select desired time, the current written time above is not updated.
I use creat-react-app, do I need to configure weback json? If so, let me tell you that I don't have that file in my create-react-app. Please help.

@lazreg87
Copy link
Contributor

You need to update the time value in the TimePicker, e.g.

class TimePickerWrapper extends Component {
  constructor(props) {
    super(props);
    this.state = {
      time: ''
    };
    this.onTimeChange = this.onTimeChange.bind(this);
  }

  onTimeChange(time) {
    this.setState({time});
  }

  render() {
    return (
      <TimePicker time={this.state.time} draggable={false} onTimeChange={this.onTimeChange} theme="classic"/>
    );
  }
}

@ecmadao
Copy link
Owner

ecmadao commented Jun 21, 2018

@msman
Yes, as @lazreg87 said, you need save hour/minute/meridiem as state.
Besides, onHourChange/onMinuteChange/onMeridiemChange props were abandon now (since v3.1.0), just use onTimeChange instead.

@ecmadao ecmadao closed this as completed Jun 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants