Internal issue 2922 - Date Picker does not support `undefined` min or max props
- Dominant language
- TypeScript
- Stars
- 53
- Forks
- 63
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 15
Description
When working with the date picker component using React, if the min or max props passed into the component are {{undefined}} and the value prop is set to a valid date, the date picker does not render the calendar when {{show calendar}} is pressed.
With React components, setting a prop to {{undefined}} should be the same as not specifying the prop at all. However, this is not the case with the min and max props for the date picker. A current workaround is to set the prop like so:
{noformat}// minDate is potentially undefined
{noformat}
See this StackBlitz for an example of the bug: [https://stackblitz.com/edit/jidkvb?file=src%2Fapp.tsx|https://stackblitz.com/edit/jidkvb?file=src%2Fapp.tsx]
Contributor guide
Research direction
Reproduce the issue using the linked StackBlitz example with a valid value and undefined min or max props. Then locate the date picker component's handling of those props and verify the calendar renders when show calendar is pressed. Done means undefined min and max behave like omitted props without requiring the documented workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100