DateInput default settings can easily crash application in dev mode
#4,251 建立於 2020年7月29日
描述
Summarizing a collection of grievances in https://github.com/palantir/blueprint/issues/3394, https://github.com/palantir/blueprint/issues/2965, https://github.com/palantir/blueprint/issues/3407, and other issues:
Environment
- Package version(s): datetime 3.18.5
- Operating System: macOS
- Browser name and version: any
Code Sandbox
From @barrymay in https://github.com/palantir/blueprint/issues/3394#issuecomment-665406086:
https://codesandbox.io/s/angry-morse-hn3rm?file=/src/App.js
To see the problem:
- Enter 1/1/1999. Hit 'enter'
Actual behavior
Page crashes during validateProps() lifecycle method
Expected behavior
Page does not crash, instead we get some nicer out-of-the-box error handling like the docs example:

Possible solution
The developer has provided a valid parseDate function, but since they are using the default values of minDate and maxDate set by the component, they are not able to properly validate whether the entered date is out of bounds. Another option would be to wrap the component in an ErrorBoundary, but that's clunky and heavy-handed.
In general I think users should be setting their own minDate and maxDate bounds. But since we have already set the defaults in the API I think we should improve the developer experience here without breaking the API.