Skip to content

Commit

Permalink
fix(DatePicker): updated logic for parsing and focus management (#9794)
Browse files Browse the repository at this point in the history
  • Loading branch information
thatblindgeye authored Nov 13, 2023
1 parent 75442bf commit a12cf31
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/react-core/src/components/DatePicker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const DatePickerBase = (
className,
locale = undefined,
dateFormat = yyyyMMddFormat,
dateParse = (val: string) => val.split('-').length === 3 && new Date(`${val}T00:00:00`),
dateParse = (val: string) => (val.split('-').length === 3 ? new Date(`${val}T00:00:00`) : new Date(undefined)),
isDisabled = false,
placeholder = 'YYYY-MM-DD',
value: valueProp = '',
Expand Down Expand Up @@ -230,7 +230,7 @@ const DatePickerBase = (
return (
<div className={css(styles.datePicker, className)} ref={datePickerWrapperRef} style={style} {...props}>
<Popover
elementToFocus={valueDate ? focusSelectorForSelectedDate : focusSelectorForUnselectedDate}
elementToFocus={isValidDate(valueDate) ? focusSelectorForSelectedDate : focusSelectorForUnselectedDate}
position="bottom"
bodyContent={
<CalendarMonth
Expand Down

0 comments on commit a12cf31

Please sign in to comment.