I have DatePicker on my form and;
i'm using this package: [https://reactdatepicker.com/#example-specific-time-range][1]
on the selection start date: I want to make disable all times before the current time. So if now 3 AM. before hours (2 AM, 1 AM, 12 AM) will be disabled.
Usually, it's making like that: But here they write static time, I want to add there current hour of the current time.
<DatePicker
selected={startDate}
onChange={date => setStartDate(date)}
showTimeSelect
minTime={setHours(setMinutes(new Date(), 0), 17)}
maxTime={setHours(setMinutes(new Date(), 30), 20)}
dateFormat="MMMM d, yyyy h:mm aa"
/>
So i saw some examples about that and trying this:
const now = moment().toDate();
<DatePicker
selected={this.state.startDate}
onChange={event => this.getStartDate(event)}
showTimeSelect
timeFormat="haa"
timeIntervals={60}
minDate={now}
minTime={now.hours(now.hour()).minutes(now.minutes())}
maxTime={now.hours(23).minutes(45)}
dateFormat="MM/d/yyyy hhaa"
timeCaption="Hour"
/>
but nothing happened. Where I make a mistake?