Open stevecastaneda opened 5 years ago
After a bit more testing, when trying to use the moment
package to calculate a minimum date, the error only seems to throw when any calculation is done. .add(30, "days")
for example should work, but the error is thrown.
If you remove the .add
function call, and just use .startOf
, the error is not thrown.
<Form.Input
minDate={moment().add(1, 'd')}
/>
If today is last day of month and we set minDate as next (switch month), we will crash, coz calendar can not contains available dates which to be selected
return selectable[0].position;
how said @stevecastaneda
Describe the bug When the field is initially rendered with a null or an empty string value, minDate param will throw an error. The sandbox linked below doesn't seem to detail the error, but locally I get this:
TypeError: Cannot read property 'position' of undefined
Thrown by this piece of code:
Likely due to
selectablePositions
being an empty array when the function is called.To Reproduce
When you start with a default date instead of an empty string, and then clear the date input field by backspacing or clearing with select/delete, the date input doesn't throw an error. It's only when the component is first rendered without a date or empty string it seems.
Expected behavior When the field is empty, calendar should still open with a minimum date.
Dependencies versions Provide version numbers of following packages: