reactjsdatetimenpmreact-datetime

react-datetime + set interval in React


I am using react-datetime control for npm package :click here. In that time picker how should I set Interval. For example I want to set interval in every 5 minutes so first show 0 then 5,10,15 etc. how can I achive this?

I am using look like this but not working :

Example


Solution

  • timeConstraints allows for custom step configuration, so, it should look like:

      minutes: { step: 5 }
    

    example:

    {
      timeConstraints = {
        minutes: {
          step: 5
        }
      }
    
      render() {
    
        return (
          <Datetime timeConstraints={this.timeConstraints} />
        );
      }
    }