react-multi-date-picker
react-multi-date-picker copied to clipboard
Multi-range mode DatePicker value typing is invalid.
When dealing with the multi-range mode of the DatePicker, the available value property does not change its allowed types.
Currently, the multi-range allows for the following:
export type Value =
| Date
| string
| number
| DateObject
| Date[]
| string[]
| number[]
| DateObject[]
| null;
However, the multi-range makes use of the DateObject[][], Date[][], etc. types. This means that it is not possible to pass this 2D-array into the value property as follows:
<DatePicker
multiple
range
format="DD/MM/YYYY"
value={[[new Date(), new Date()], ...]}
/>
It is currently necessary to add a ts-ignore, for this reason.
A possible solution could be to add the 2d-array type to the Value type, or to add a separate value type for multi-range mode date pickers.
It's a minor issue, but ts-ignore statements aren't the nicest to have in a code base.
Thank you for your contributions to OSS, we love this library.
Thank you for reporting this issue. I will work on it.
Hello, is the issue fixed? Asking because I have the same problem.
It should be fixed in v4.5.1.