react-datepicker
react-datepicker copied to clipboard
selectsRange with showTimeInput shows only one time input
Describe the bug
trying to have selection of range with time, have only 1 time selection
To Reproduce
use this code snippet:
const NewDatePicker = () => {
const [dateRange, setDateRange] = useState([null, null])
const [startDate, endDate] = dateRange
const ExampleCustomInput = forwardRef(({ value, onClick }, ref) => (
<button className='example-custom-input' onClick={onClick} ref={ref}>
{value}
</button>
))
return (
<DatePicker
selected={startDate}
onChange={update => {
const isDateUpdate = Array.isArray(update)
setDateRange(isDateUpdate? update: [update, endDate])
}}
startDate={startDate}
endDate={endDate}
selectsRange
monthsShown={2}
customInput={<ExampleCustomInput />}
dateFormat='mm/dd/yyyy hh:mm'
showTimeInput
/>
)
}
Expected behavior
have selection of times for both start and end dates
Desktop
- OS: mac
- Browser: chrome
Same. Any updates on this?