Reputation: 5335
Im using ant design time picker for my react application, i have some conflict on the time pricker, i want to know how to disable past time before the today current time.
This is my code
getDisabledTime = () => {
var hours = [];
for(var i =0; i < moment().hour(); i++){
hours.push(i);
}
return hours;
}
<TimePicker onChange={onChange} disabledTimes={this.getDisabledTimes()}/>
Upvotes: 0
Views: 2067
Reputation: 6112
The prop name is disabledHours
and it is a function.
function getDisabledHours() {
var hours = [];
for (let i = 0; i < moment().hour(); i++) {
hours.push(i);
}
return hours;
}
<TimePicker disabledHours={getDisabledHours} />
Working codesandbox.
Upvotes: 1